QuestionQ23

Java SE APIs

Which of the following statements is true?

  • A IllegalStateException is thrown if a thread in waiting state is moved back to runnable.
  • B A thread in waiting state consumes CPU cycles.
  • C After the timed wait expires, the waited thread moves to the terminated state.
  • D A thread in waiting state must handle InterruptedException.
Explanation

Object.wait() and Thread.join() are interruptible waiting operations that declare the checked InterruptedException; invoking code must catch it or declare it. A waiting thread does not consume CPU time, and expiration of a timed wait permits execution to resume rather than terminating the thread. Oracle Java Thread API

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!