Results 1 to 4 of 4
  1. #1
    Sircedric88 is offline Member
    Join Date
    Jul 2007
    Location
    Las Vegas
    Posts
    14
    Rep Power
    0

    Default JDK 5.0 Scanner Class

    Hey, I'm new to this forum, as well as Java. I know that JDK 5.0 has a scanner class for detecting keyboard input as chars, ints, and Strings.
    I am using Eclipse, and I created a new Java project with JRE 1.5.0_06.
    I updated the JDK with NetBeans, so I am sure I am up-to-date.

    I created a simple program in Eclipse which used Input. So the program automatically imported java.util.Scanner. And I wrote my code:
    Scanner keyboard = new Scanner(System.in);
    char in = keyboard.nextChar();

    Everything is recognized but nextChar();
    Please help me, because I really want to learn Java. I will try to help people with their problems and such. I will be an ective member of this forum!

    Thank you for all you help, time and support!

  2. #2
    Sircedric88 is offline Member
    Join Date
    Jul 2007
    Location
    Las Vegas
    Posts
    14
    Rep Power
    0

    Default

    please help
    :)

  3. #3
    levent Guest

    Default

    I am using Eclipse, and I created a new Java project with JRE 1.5.0_06.
    I updated the JDK with NetBeans, so I am sure I am up-to-date.
    Make sure that your project uses Java 5.0. Projects has their own specs and that project may still point to an older version of Java.

    and what is the exact error?

  4. #4
    Sircedric88 is offline Member
    Join Date
    Jul 2007
    Location
    Las Vegas
    Posts
    14
    Rep Power
    0

    Default

    The error is that it just won't compile. It will show my text underlined in red. I was asking one of my friends, and he informed me that there is no char scanner class, just Ints and Strings. Is this correct for a String scanner :

    Scanner key = new Scanner(System.in);
    String s = key.next();

    and Int is


    Scanner key = new Scanner(System.in);
    int i = key.nextInt();

    Thank you for helping me out!:)

Similar Threads

  1. Using Scanner class to read int value
    By Java Tip in forum Java Tip
    Replies: 1
    Last Post: 02-07-2009, 02:47 AM
  2. Getting tokens using Scanner class
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-05-2008, 09:11 AM
  3. Using Scanner class to read int
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-18-2008, 11:50 AM
  4. Scanner class
    By ajaymenon.k in forum Advanced Java
    Replies: 1
    Last Post: 11-26-2007, 07:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •