1. Figure out what the program does.
2. Implement the run method so that each second
the count is displayed, separated by spaces and starting from numSeconds down to 1, and then "Go!" (see the examples).
3. If the thread runs for 3.5 seconds or more, interrupt it using the interrupt method and wit
Countdown at the races
- 18
Locked
Comments (7)
- Popular
- New
- Old
You must be signed in to leave a comment
Angel Stefan
11 January 2022, 16:25
I spent a lot of time because I didn't understand that in this case, when: numSeconds = 3; the task only need to display "3 2 1 Go!".
I have try many times to understand how to print no. 4 when numSeconds = 3; impossible task 😪 if numSeconds = 4(but is not!) then print(anotherString) but in this task is not the case. Keep code!
0
Hoist
5 March, 02:37
Help here: https://codegym.cc/help/6056
0
LennyMan
30 December 2020, 15:58
I resolved correctly the task, but im not sure to understand why if we put Thread.sleep fo 3.5 seconds, the method throw the InterruptedException
0
LennyMan
30 December 2020, 16:00
Ok maybe i understood , the method throw the exception when in the main reach the line clock.interrupt(); (after 3.5seconds) , is it correct?
+3
Liliane Top
5 April 2020, 12:23
Good advice. Do not look at the examples as given in the previous lesson. They will just confuse you. Find a source outside of CodeGym if you want to understand how this works as the information given in lesson 8 and 9 are not working. Try for yourself!
0
Nikolaos
8 October 2019, 17:59
It takes me about 2 hours...
-_-
+1
Robin Singh Chauhan
22 August 2019, 19:57
The only problem is i am able to display the exact output but not able to do it together this means at numSeconds=3; the output for numSeconds=3 is correct but wrong for numSeconds=4 and vice versa
0