Question: Question: What happens when a thread is waiting on an objects monitor using the wait() method, and the objects notify() method is called by another

Question: What happens when a thread is waiting on an object’s monitor using the wait() method, and the object’s notify() method is called by another thread?

A) The waiting thread is immediately resumed and starts running.
B) The waiting thread will be moved to the runnable state but still needs to reacquire the lock before resuming.
C) The notify() method will directly interrupt the waiting thread, causing it to throw an InterruptedException.
D) The waiting thread continues to wait until the notifyAll() method is called.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The detailed answer for the above question is provided below The correct option is B The waiting thread will be moved to the runnable state but still ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!