This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Synchronization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Synchronization" Watch "Synchronization" New topic


Sundeep Gupta

Joined: Feb 28, 2006
Posts: 13
Hi all,

Does a thread releases lock on all the objects when it calls wait() on an object, or only the lock of that specific object is released.

I think other object's lock will be held with thread.

Tell me whether i'm right or wrong


SCJP 5.0
Henry Wong

Joined: Sep 28, 2004
Posts: 20166

wait() will only release the lock on the object that you are waiting on.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
I agree. Here's the link:
subject: Synchronization
It's not a secret anymore!