|
-
Oct 11th, 2006, 10:35 AM
#1
Thread Starter
Hyperactive Member
Simple input/output question
I have got this code, but its not working in my computer, I'm using Textpad 4 for compiling:
Code:
import java.util.Scanner
public class Addition
{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
int a,b,sum;
System.out.println("Enter the first integer: ");
a = input.nextInt();
System.out.println("Enter the second integer: ");
b = input.nextInt();
sum = a + b;
Sytem.out.printf("Answer is: %d",sum);
}
}
And the compiling error is:
C:\Documents and Settings\Computer\My Documents\My Homeworks\Java\Addition.java:1: cannot resolve symbol
symbol : class Scanner
location: package util
import java.util.Scanner;
^
C:\Documents and Settings\Computer\My Documents\My Homeworks\Java\Addition.java:6: cannot resolve symbol
symbol : class Scanner
location: class Addition
Scanner input=new Scanner(System.in);
^
C:\Documents and Settings\Computer\My Documents\My Homeworks\Java\Addition.java:6: cannot resolve symbol
symbol : class Scanner
location: class Addition
Scanner input=new Scanner(System.in);
^
C:\Documents and Settings\Computer\My Documents\My Homeworks\Java\Addition.java:15: cannot resolve symbol
symbol : method printf (java.lang.String,int)
location: class java.io.PrintStream
System.out.printf("Summation is: %d",sum);
^
4 errors
Tool completed with exit code 1
-
Oct 11th, 2006, 12:00 PM
#2
Re: Simple input/output question
The textpad version is all yours, no one here would care about.
It's the JDK version you must specify, which I guess is 1.4.2 or older, because all JDKs older than 1.5 didn't support the java.util.Scanner class or the System.out.printf method
Last edited by ComputerJy; Oct 11th, 2006 at 12:04 PM.
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Oct 11th, 2006, 12:02 PM
#3
Re: Simple input/output question
Another thing. It's
Code:
import java.util.Scanner;
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Oct 11th, 2006, 12:25 PM
#4
Thread Starter
Hyperactive Member
Re: Simple input/output question
yeah its: Version 1.4.2
is there anyway to get the latest editions but i want it to be less then 50mb or something like this not 130mb..
-
Oct 11th, 2006, 02:54 PM
#5
Lively Member
Re: Simple input/output question
I don't think so, you might be able to do an update and fix it that way with less bytes but I doubt it.
-
Oct 11th, 2006, 03:44 PM
#6
Re: Simple input/output question
Nope, no incremental updates in Java. I think the full SDK is only 45 MB, though.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|