System.out.println("What letter should the word begin with?");
char letter = input.next().charAt(0);
if(letter != ''){
throw new InputMismatchException("Please input a letter");
}
I want to check to see if the user input anything besides a string/char. If they have I want to throw an exception that says the input is wrong. This is my current code but as it stands it does not compile.
if (letter >= 'A' && letter <= 'Z').