Java Bootcamp – Workbooks and Challenges
)}

Global Superstore 2

Prerequisite: You wrote the solution for part 1.

Goal: Monitor the thread state.

Task 1


Place comments on the "Scanner" related code.

Task 2


From the main thread, print the state of thread2 when it's NEW.

Task 3


From the main thread, print the state of thread2 when it's Runnable.

Task 4


From the main thread, print the state of thread2 when it's TERMINATED.

Use interrupt() and sleep() to accomplish this task. For this task, you can only sleep the main thread for 10 milliseconds.

Task 5


In preparation for Part 3:

  • Remove every call to getState().
  • Uncomment the Scanner related code.

Good Luck!


Feedback Summary
4.8
39 students
5

92%
4

3%
3

0%
2

0%
1

5%
Written Reviews
There are no written reviews yet.