So I have an infinite loop running in the main thread of my console application like so.
public static void main(String[] args) {
while(true){
doSomething();
doSomethingElse();
System.out.println("some debugging info");
doAnotherThing();
}
}
I want this code to run over and over and over.
Once in a while, I would like to input a command into the console, such as the string "give me more info plox", and then if that command equals something, I want my code to do something.
Normally I would just use a scanner, but I can't do that here - since scanner.next(); pauses my code... I want my code to keep running whether or not I enter a command. The only workaround I can see is by using a file. But is there any other option?