Java OCA OCP Practice Question 2197

Question

Which one of these events will cause a thread to die?

Select the one correct answer.

  • (a) The method sleep() is called.
  • (b) The method wait() is called.
  • (c) Execution of the start() method ends.
  • (d) Execution of the run() method ends.
  • (e) Execution of the thread's constructor ends.


(d)

Note

A thread dies when the execution of the run() method ends.

The call to the start() method is asynchronous, i.e., it returns immediately, and it moves the thread to the Ready-to-run state.

Calling the sleep() or wait() methods will block the thread.




PreviousNext

Related