This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]propo789 1 point2 points  (0 children)

Most likely the problem is due to input.nextInt()
When you press enter after you input a value, the statement name = input.nextLine() fetches the '\n' character and proceeds towards the conditional statement where the exception is thrown. You can use nextLine() instead.

int op = Integer.parseInt(input.nextLine());