+ 2
Please help me in implementing the below "Timeout" scenario in java using threads
User should prompt to give some input value. if user enters some input before 1min , "Congratulations" has to be printed. Otherwise "Better luck next time " has to be printed. please help. what logic I need to use?
2 odpowiedzi
+ 3
You need to place time counter in second thread and when it reach given value - write a message and close first thread which still awaiting for input.
+ 3
Also if user do input in time you just close thread with counter.