| Author |
Question on static synchronized method
|
Brian Nguyen
Greenhorn
Joined: Mar 19, 2002
Posts: 22
|
|
Hello, I am just curious about the following method declaration: public static synchronized void methodA(){} What is the meaning of "static" fiel here? Does it mean that in an multithreaded environment, only one thread can call the above method of the class at a time? Thanks for your answer in advance Brian
|
 |
Greg Charles
Bartender
Joined: Oct 01, 2001
Posts: 1855
|
|
|
Yes. Static in general means the method belongs to the class, rather than a particular instance of it. When you have a static synchronized method, it means threads calling it are synchronized on the class itself, not on an object. That is, one thread must execute that method (or any other synchronized method) completely before another thread is allowed to enter.
|
 |
 |
|
|
subject: Question on static synchronized method
|
|
|