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 in another line in the console essentially doing nothing.
Scanner input = new Scanner(System.in);
System.out.println("Enter Student ID:");
String sID = null;
if (input.hasNextInt()==false){
System.out.println("Please re-check the student number inputted. Student number can only be digits.");
throw new BadUserInputException("Student number can not contain non-digits.");
}else if (input.next()==""){
throw new BadUserInputException("Student number can not be empty");
}