This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
Don't get me started about those stupid light bulbs.
subject: synchronized static methods
Similar Threads
static synchronized block
class level lock and object level lock
locking style
synchronized method