Results 1 to 6 of 6

Thread: Simple input/output question

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2006
    Posts
    384

    Arrow 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

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    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

  3. #3
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    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

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2006
    Posts
    384

    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..

  5. #5
    Lively Member
    Join Date
    Oct 2005
    Posts
    74

    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.

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    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
  •  



Click Here to Expand Forum to Full Width