1. In the run method, add a delay of 10 milliseconds after all the actions. Display "Thread interrupted" if the thread is interrupted.
2. Make all the threads run sequentially: first, for thread 1, count down from COUNT to 1; then for thread 2 - from COUNT to 1, etc.
Example:
#1: 4
#1: 3
...
#1: 1
#
Consecutive threads
- 4
Locked
Comments (5)
- Popular
- New
- Old
You must be signed in to leave a comment
Justin Smith
7 September 2021, 16:38
This "Easy" task was harder than a lot of "Hard" tasks. At least I found it so.
0
Felix
11 April 2020, 00:14
This seems to do the job just fine but isn't validated as correct. Am I wrong with doing it that way?
0
Justin Smith
7 September 2021, 16:41
You can either do
which I have seen in some users' solutions, or declare Thread t; earlier in the code and then do:
I did it the second way because I didn't know we could use a method call the way it is used in the first one. 0
Santosh Kumar
1 July 2019, 15:32
Unknown error during task verification
0
Roman
3 July 2019, 09:47
Do not use Thread.currentThread().interrupt(). You interrupted tests.
0