sorry if this is a silly question but I am looking for a way to break and start another iteration of the loop if the user's input is null. Here's my code:
while(true) {
// Get the users input
Scanner Input = new Scanner(System.in);
System.out.println("Enter text:");
String studentInfo = Input.nextLine();
if (studentInfo == null) {
System.out.println("Please enter valid infomation.");
break;
}
continue;
}
After the break, I want it to go back to the while(true) and start again from there, by asking the user for an input again.
Thanks guys,
JT
nextLine()can never returnnull.breakthan?