I have a code inside an infinite loop. I would like to apply a method which checks whether I press a button or not as a loop breaker.
while (true) {... if (this.escapeKeyIspressed ()) // If really the escape on that millisecond then ...}} What is the easiest way to do this in Java?
P presents a method to set the console in non-intercept mode to read , Which you can use to break your loop. It also presents some other methods for both Python and Java, but it is considered to be a little laughing and non-portable (for example, Windows will not work under). I do not think there is a 'good' easy way to do this. I'm scared.
Comments
Post a Comment