If you want user input to be strings only and you want to catch any integers entered by the user, how do you do it?I want the user to enter string values only and to catch any integers entered, when I input integers its doesn't display the error message.
The input to the command line/standard input stream is always in text format. Everything you pass into it is a String. You cannot get a number from the standard input stream, you can only take the input and parse it as a number. Which you are not doing. Any text counts as a valid String, even the empty (0‑length) String. There is no built‑in way to test that text constitutes a word in English. You can try testing the input to see whether it is a number. Pass the text to a Scanner constructor and try its hasNextXXX() methods. Or you can try a regular expression to test for letters. Neither approach is really good however.