The wait() may cause a thread to stop executing.
Option A is correct. The wait() method makes the active thread wait until another thread calls this object's notify() or notifyAll() methods.
Option B is incorrect. A single thread waiting on this object's monitor is awakened by the notify() function.
Option C is incorrect. Notifies every thread that is waiting on this object's monitor by calling notifyAll().
Option D is incorrect. The thread holding the lock or the thread in the synchronized method typically quits the synchronized method when a lock is released. The lock is released when another thread enters a synchronized procedure on that object. Does executing threads halt while entering or leaving synchronized code? Not required, as the thread can still execute unsynchronized code. The word directly in the question, in my opinion, gives us a hint. The execution of a thread is not immediately stopped when synchronized code is exited.
☛ Related Questions:
- A data warehouse is which of the following?
- Which of the following is not the member of class?
- Which of the following function never take any argument?
- Constructor is executed when