Exception in thread “main” java.util.InputMismatchException

前端 未结 2 1060
醉梦人生
醉梦人生 2020-11-30 14:10

i need help with one exercise in java, i\'m stuck on this error 2 hours maybe. Any help would be great.

Exception in thread \"main\" java.util.InputMismatch         


        
相关标签:
2条回答
  • 2020-11-30 14:44

    This Exception Thrown by a Scanner to indicate that the token retrieved does not match the pattern for the expected type, or that the token is out of range for the expected type.

    String imer = input.next();// Use for String Input
    input.nextLine();//Use for next line of input
    int cenar = input.nextInt();
    
    0 讨论(0)
  • 2020-11-30 14:55

    You need to put an int in before you get to imer or cenar:

    n=input.nextInt();
    

    This line doesn't appear to be doing anything, either remove it, or put a number in before you put your imer or cenar values in.

    0 讨论(0)
提交回复
热议问题