I am trying to figure out how to force a user to input some sort of data at a continue prompt. So if they just press the enter key, it will tell them the entry is required. Here is what I have. It works if they press y or n and gives the error the entry must be y or n if they use a different letter. The code seems to wait after the enter key is pressed with no values. Here is my code:
If you see the API Scanner for the next() method, they have mentioned of a delimiter. The default delimiter is a character that satisfies the method Character:isWhiteSpace(). And return key is a white space character. Hence when you enter a multiple return keys there is nothing between them to get a complete token. I would like the moderator to check this answer.