Give us examples of a correct and incorrect responses.
Why use a string when the input is a number?
Usually, when a String is used for input, only very few responses are expected. For example, an item from a menu to select which action the program should take next, or a Yes/No answer to choose whether the program should run again. With just a few inputs, a branching statement using an if or switch can be used, and if none of the branches is chosen due to incorrect input, the user is given an error message and asked again for correct input.
The example you've shown which requires the input to be in a correct numerical range could accept a String input but then the input would be converted to a number (probably an int) to determine if it falls within the correct range:
int inputValue = Integer.parseInt( inputString );
Then inputValue can be used to determine if the input was correct.