Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Java by (13.1k points)

Can anyone help me with the below error, when I was trying to input the double value in throws this error:

Exception in thread "main" java.util.InputMismatchException

at java.util.Scanner.throwFor(


at java.util.Scanner.nextDouble(

at MarkingSystem.checkValueWithin(

at MarkingSystem.askForMarks(

at World.main(

Java Result: 1

Any help would be appreciated.

1 Answer

0 votes
by (26.7k points)

So basically, this error popped up if the token is not a float or is out of range. You can try to catch the following exception like:

try {

    // ...

} catch (InputMismatchException e) {

    System.out.print(e.getMessage()); //try to find out specific reason.


I hope this will help.

Want to know more about Java? Prefer this tutorial on Learn Java.

Want to become a Java Expert? Join Java Course now!!

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94.1k users

Browse Categories