I am trying to read input continuously from the user until the user types quit. I am testing it by just typing 'quit' but console.hasNext() doesn't seem to be returning false. In fact it seems that the program is blocked on line 7(hasNext() line). Any ideas?
boolean bool = true;
while (bool) {
System.out.println("Type 'quit':");
Scanner console = new Scanner(System.in);
if (console.next().equals("quit")) {
System.out.println("You typed quit");
System.out.println("check: " + console.hasNext()); // This line doesnt print
bool = false;
}
}