Which of the following statements about the wait()
and notify()
methods is true?
wait()
and notify()
methods can be called outside synchronized code. notify()
method call. wait()
goes into the monitor's pool of waiting threads. notify()
gives up the lock. C.
The thread that calls wait()
goes into the monitor's pool of waiting threads.
Option A is incorrect because wait()
and notify()
must be called from within synchronized code.
Option B is incorrect because the notify()
arbitrarily selects a thread to notify from the pool of waiting threads.
Option D is incorrect because the thread that calls wait()
is the thread that gives up the lock.