The Scanner has a hasNextInt() function that returns true if the next token is a Integer. So before calling nextInt() validate if hasNextInt() is true. If it fails, show a message to the user asking him to enter an integer. Note, The Integer doesn't necessarily needs to fall in your required range, so make sure you also have a final else to inform the user the number he entered was invalid.