Java OCA OCP Practice Question 1249

Question

A monitor called mon has 10 threads in its waiting pool.

All these waiting threads have the same priority.

One of the threads is thread1.

How can you notify thread1 so that it alone moves from the Waiting state to the Ready state?

  • A. Execute notify(thread1); from within synchronized code of mon.
  • B. Execute mon.notify(thread1); from synchronized code of any object.
  • C. Execute thread1.notify(); from synchronized code of any object.
  • D. Execute thread1.notify(); from any code (synchronized or not) of any object.
  • E. You cannot specify which thread will get notified.


E.

Note

When you call notify() on a monitor, you have no control over which waiting thread gets notified.




PreviousNext

Related