Results 1 to 3 of 3
  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
    The errors in the 5th line
    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
    seanzhang is offline Member
    Join Date
    Jan 2009
    Posts
    6
    Rep Power
    0

    Default

    import java.util.Scanner;

    public class wordlength {
    public wordlength() {
    }
    public static void main(String[] args) {

    // the errors are in the next line

    Scanner stdin = new Scanner(System.in);
    System.out.print("Enter Word");
    String word = stdin.nextLine();
    int wordlength = word.length();
    System.out.println("word"+word+"has length"+wordlength+".");
    }}

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

    Default

    Quote Originally Posted by seanzhang View Post
    import java.util.Scanner;

    public class wordlength {
    public wordlength() {
    }
    public static void main(String[] args) {

    // the errors are in the next line

    Scanner stdin = new Scanner(System.in);
    System.out.print("Enter Word");
    String word = stdin.nextLine();
    int wordlength = word.length();
    System.out.println("word"+word+"has length"+wordlength+".");
    }}


    THanx THanx THanx THanx THanx THanx THanx so match :D

Similar Threads

  1. 2 errors with Scanner , help
    By enghar in forum New To Java
    Replies: 3
    Last Post: 01-25-2009, 04:03 AM
  2. makeButton errors
    By ljk8950 in forum AWT / Swing
    Replies: 12
    Last Post: 08-10-2008, 02:10 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
  •