user1670000
user1670000

Reputation: 21

How to set a time limit for user to enter input?

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

Answers (1)

Related Questions