Why am I getting InputMismatchException?

Here you can see the nature of Scanner: double nextDouble() Returns the next token as a double. If the next token is not a float or is out of range, InputMismatchException is thrown. Try to catch the exception try { // … } catch (InputMismatchException e) { System.out.print(e.getMessage()); //try to find out specific reason. } UPDATE CASE … Read more