Countdown at the races

  • 18
  • Locked
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
You can't complete this task, because you're not signed in.
Comments (7)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Angel Stefan
Level 23 , Sibiu, Romania
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!
Level 21 , San Diego, United States
5 March, 02:37
Help here:
Level 25 , Lucca, Italy
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
Level 25 , Lucca, Italy
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?
Liliane Top
Level 17 , Amsterdam, Netherlands
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!
Level 19 , Vrontados, Greece
8 October 2019, 17:59
It takes me about 2 hours... -_-
Robin Singh Chauhan
Level 17 , Periyakulam, India
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