Multiple choice

It is given that a monitor called 'abc' has 4 threads in its waiting pool and all these waiting threads have the same priority. The name of one of the threads is 'thrd1'. How will you notify 'thrd1' so that it alone moves from its waiting state to ready state?

  1. Execute notify(thrd1); from synchronized code of abc.

  2. Execute abc.notify(thrd1); from synchronized code of abc.

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

  4. You cannot specify which thread will get notified.

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

This is the right answer as notify() method notifies the thread to move from its waiting state but does not tell which thread is to be notified specifically.