aspose file tools
The moose likes Java in General and the fly likes regarding static method Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "regarding static method" Watch "regarding static method" New topic
Author

regarding static method

rai talari
Ranch Hand

Joined: Jan 31, 2006
Posts: 34
If Static method is synchronized which object is considered for lock?


nothing is impossible in the world even the word impossible sounds as I'M'Possible.
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
The instance of java.lang.Class associated with the class in which the method resides.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
Raghu Arikeri
Greenhorn

Joined: Jan 09, 2006
Posts: 15
hi,
just want add something to what Peter Chase said...

For every class loaded, the JVM has a corresponding java.lang.Class instance. So when a static method is synchronized, it's the lock of java.lang.Class instance which is used.

for instance methods there will be one lock per instance and for static methods one lock per class


Raghu
"Work for a cause and not applause. Live to express and not to impress"
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: regarding static method
 
Similar Threads
Float wrapper takes double primitive implicitly.
Question
can a static method be override.
tere is a ques abt static method.
About overriding