String[] alpha = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}; I have made the Array above including all the letters in the alphabet for a letter guessing game.
I am not sure how I could get an error message to appear if the user enters something outside of these values of the alphabet eg. a number? Any help would be greatly appreciated.
if(value.equals("\\d"))--> error. or even easier, vonvert the array to a list and perform a check like this:if(!list.contains(value))-->error!input.matches("[a-z]")should work... Forget the array of the alphabet