File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Whose lock will be obtained Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Whose lock will be obtained" Watch "Whose lock will be obtained" New topic
Author

Whose lock will be obtained

Anupam Sinha
Ranch Hand

Joined: Apr 13, 2003
Posts: 1088
When a static thread is synchronized on whose object is the lock obtained.
Dan Chisholm
Ranch Hand

Joined: Jul 02, 2002
Posts: 1865
There is an object of type Class that represents each class type that has been loaded. Static methods are synchronized on the lock for that Class instance. Take a look at the javadoc for the getClass method of the Object class.


Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Whose lock will be obtained