+ 3

What's that exception in the code attached?

I am getting an exception on the code which I attached. Could you please help me to get rid of that exception. https://code.sololearn.com/c2Ggx5Q5a9F8/?ref=app

15th Oct 2017, 1:05 PM
Anil Patil
Anil Patil - avatar
1 Answer
+ 2
The InputMismatchExveption is when the scanner gets a string instead of an Integer for example. You can Solve this If you catch this Exception and print "Please type in a number" for example. try { // Your code } catch (java.util.InputMismatchException){ System.out.println("Type in a number"); }
15th Oct 2017, 7:52 PM
David
David - avatar