Reputation: 21
I'm making an application that simulates a simple game. It is necessary to limit the players, so they have 60 seconds to enter their answers. I have a problem if they don't type anything and the time limit expires, then it's necessary to close the Scanner (System.in) that I opened so that they could enter their answers, and give 0 points to one who did not respond in time. If anyone has a solution for me, please help me.
Upvotes: 2
Views: 1749
Reputation: 827
Try TimerTasks, check out http://docs.oracle.com/javase/7/docs/api/java/util/TimerTask.html
Upvotes: 1