Interview Questions

Does thread leaves object lock when wait() method is called?

Java Interview Questions and Answers (part 4)


(Continued from previous question...)

36. Does thread leaves object lock when wait() method is called?

When wait() method is called Thread leaves the object lock and goes from running to waiting state. Thread waits for other threads on same object to call notify() or notifyAll() and once any of notify() or notifyAll() is called it goes from waiting to runnable state and again acquires object lock.

(Continued on next question...)

Other Interview Questions