What I\'m trying to do is if the user clicks on the enter key the program should throw a BadUserInputException. My problem is whenever I press the enter key it just puts me
The scanner looks for tokens between whitespaces and newlines - but there aren't any. I don't tend to use Scanner
for reading from standard input - I use the old-fashioned BufferedReader
method like this:
BufferedReader buf = new BufferedReader (new InputStreamReader (System.in));
and then I can say
String line = buf.readLine ();
if (line.equals ("")) blah();
There may be an easier solution however.