dimanche 17 juillet 2016

Keeps printing output in the Linux terminal until it reads an input

I am a newbie in Java and Object-oriented programming. Let's say I have created a 2d array game grid and initialized the array with characters. I have the following code:

while (true) {
    if (....) map.printMap();   //what should be the condition here??
    else ...dosomethingelse...;
}

Does there exist a method which I can place it in the if condition if I want to keep printing my game grid on the screen before it detects an input? If there is an input, it will stop printing and execute the else condition , then continue to keep printing the grid on screen, until the next input and so on?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire