0

In java, how to stop delay loop after taking entry

Ex-There is a quiz for which you have given 10 seconds to answer. if, I have answered with in the given time so how to stop delay loop

18th Nov 2019, 11:28 AM
Harshita Shreya
Harshita Shreya - avatar
2 odpowiedzi
+ 2
The question seems simple enough, but there is no easy solution here, definitely not beginner level. You would have to understand a lot about threads and concurrency, and even then this is sort of a special case. Anyway I found this article explaining a possible solution... https://www.javaspecialists.eu/archive/Issue153.html
29th Jan 2020, 8:15 PM
Tibor Santa
Tibor Santa - avatar
0
If your asking about delay thread for 10 seconds, the answer is thread.sleep(1000); 1000 is milliseconds.. Edit : Use only one thread. And call thread. Sleep() method, then continue further... May be not a proper solution....
29th Jan 2020, 8:53 PM
Jayakrishna 🇮🇳