Results 1 to 4 of 4
  1. #1
    enghar is offline Member
    Join Date
    Jan 2009
    Posts
    3
    Rep Power
    0

    Arrow 2 errors with Scanner , help

    hi,
    im anew member >> can u help me please
    i have 2 errors with this code

    Java Code:
    public class wordlength {
      public wordlength() {
        }
      public static void main(String[] args) {
       
    // the errors are in the next line  
    
        Scanner stdin = Scanner.create (System.in);
          System.out.print("Enter Word");
          String word = stdin.nextline();
          int wordlength = word.length();
          System.out.println("word"+word+"has length"+wordlength+".");
         }}

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    double posted

  3. #3
    bassoonrules is offline Member
    Join Date
    Jan 2009
    Posts
    2
    Rep Power
    0

    Default

    I would suggest importing the Scanner class, like this.

    import java.util.Scanner;

    then have your class declarations, but before you try and get info from the user, you have to go like this:

    Scanner asdf = new Scanner (Sytem.in);

  4. #4
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

Similar Threads

  1. makeButton errors
    By ljk8950 in forum AWT / Swing
    Replies: 12
    Last Post: 08-10-2008, 02:10 AM
  2. Java Errors! Please help!
    By TearsOfTheMoon in forum New To Java
    Replies: 2
    Last Post: 06-10-2008, 10:00 AM
  3. help with these errors
    By oceansdepth in forum New To Java
    Replies: 3
    Last Post: 04-16-2008, 05:55 PM
  4. Errors I don't understand
    By MattyB in forum New To Java
    Replies: 4
    Last Post: 04-02-2008, 12:55 AM
  5. Errors in constructor
    By ai_2007 in forum Advanced Java
    Replies: 0
    Last Post: 07-01-2007, 06:35 PM

Posting Permissions

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