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
Just use nextLine() method instead of next() while scanning the String and finally check the string using isEmpty() method. This Worked for me..
nextLine()
next()
isEmpty()