Machine-translated by Google. Questions are authored in English.
Top

Discussion

The period during which isAlive() reports true - which of the following is true?

  • A.isAlive() returns true only while the thread is actually executing on a processor.
  • B.isAlive() returns true only while the thread holds at least one monitor.
  • C.isAlive() returns true from the moment start() is called until run() completes.
  • D.isAlive() returns true as soon as the Thread object is constructed.

Answer: C

A thread is alive once it has been started and has not yet died, so a blocked, waiting or sleeping thread is still alive. A constructed but unstarted thread is NEW and not alive, and so is a finished one, which is TERMINATED and can never be restarted.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.