I want it so if the user puts in something other than a number between 1 and 9 it keeps asking the user for valid input.
Whenever a user is asked to provide input, the program should expect errors.
This example shows how to validate if a String is a number.
The first example checks if it’s and Integer by trying to parse the String to an int.
So we loop through the String and pass every character in it to the is Digit() method.
If we find a non-digit character, we just halt the loop and return false.
about regular expression you are write it will be helpful .
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. With the exception of strings, if a user inputs the wrong type, the code will produce an exception and (if not handled correctly) will stop.The purpose of this code is to produce a consistent method to validate user input, and not let the program proceed until the user has inputted a correct type. The user puts in Y coordinate a letter between (A-J) and x coordinate a number between (1-9).I can validate the y coordinate but am having trouble validating the x coordinate.