InputMismatchException error...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jimgym1989
    New Member
    • Sep 2008
    • 30

    #1

    InputMismatchException error...

    Why is it that it is InputMismatchEx ception?
    I keep on tracing my code but i find it Ok and runnable but every time I run it it says:
    Exception in thread "main" java.util.Input MismatchExcepti on
    at java.util.Scann er.throwFor(Sca nner.java:819)
    at java.util.Scann er.next(Scanner .java:1431)
    at java.util.Scann er.nextInt(Scan ner.java:2040)
    at java.util.Scann er.nextInt(Scan ner.java:2000)
    at review.main(rev iew.java:23)

    Process completed.
    this is my code

    Code:
    Scanner inFile = new Scanner("D:\\My Documents\\Java Saves\\Elson.in");	
    
        
        String name = inFile.next();
        int age = inFile.nextInt();
        String month = inFile.next();
        int day = inFile.nextInt();
        int year = inFile.nextInt();
    
     inFile.close();
    this is what's inside of Elson.in

    elson 18
    November 20 1989
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    System.out.prin tln each of the matched tokens to better understand what is happening in your program.

    Comment

    Working...