I'm trying to check for empty strings with a Scanner and I'm not sure how to loop it so that it asks for the correct input.
So I want to use
System.out.print("Enter your First Name: "); String employeeFirstName = j.next(); //first name declared System.out.print("Enter your Last Name: "); String employeeLastName = j.next(); //last name declared
and I want to have it check so if the user enters a number or a blank that it asks for the input again. I tried using both if and while loops and it would still print "enter last name" after the first name and then also say it was invalid and crash the program.


LinkBack URL
About LinkBacks
Reply With Quote