Multiple choice technology programming languages

A monitor called nik has 3 threads, having same priority, in its waiting pool; How can we notify one of the threads, named 'thread1' to move from Waiting state to Ready State?

  1. Execute notify(thread1); from within synchronized code of mon.

  2. Execute mon.notify(thread1); from synchronized code of any object.

  3. Execute thread1.notify(); from synchronized code of any object.

  4. Execute thread1.notify(); from any code(synchronized or not) of any object.

  5. You cannot specify which thread will get notified.

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

The notify() method does not allow specifying which thread to notify. It selects one thread arbitrarily from the waiting pool. The notify() and notifyAll() methods have no parameters - they work on the monitor's object, not on specific threads. To notify a specific thread, you must use higher-level concurrency utilities like Lock/Condition with explicit signals.