This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes synchronized static methods 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 "synchronized static methods" Watch "synchronized static methods" New topic

synchronized static methods

mayur dhawan

Joined: Sep 20, 2005
Posts: 29
If we declare a method as public synchronized static void doThings(){}

then will the executing thread automatically take the Class lock?
If yes then can you explain how?

thanks in advance
camilo lopes
Ranch Hand

Joined: Aug 08, 2007
Posts: 202
because one method static pertence the class then if you lock the o method static you isn't lock one instance and so the class.
always that you use static the atributte pertence the class. don't forget.

Brazil - Sun Certified Java Programmer - SCJP 5 About Java - Update every Week.
Guide SCJP - tips that you need know
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: synchronized static methods
It's not a secret anymore!