I need to be able to interrupt a while loop only when a user enters something. Otherwise the loop should continue.
I tried using if (scanner.nextLine())
however this will cause the loop to wait until something is entered before moving on.
How can I keep the loop continuing until something is entered?
while (true) {
if (scanner.nextLine()) {
// statements
}
// standard loop statements
}