http://www.buyya.com/java/Chapter14.pdf
Q7) What is the difference when the synchronized keyword is applied to a static method or to a non static method?
Ans) When a synch non static method is called a lock is obtained on the object. When a synch static method is called a lock is obtained on the class and not on the object. The lock on the object and the lock on the class donĂ¢€™t interfere with each other. It means, a thread accessing a synch non static method, then the other thread can access the synch static method at the same time but canĂ¢€™t access the synch non static method.
http://java-questions.com/Threads_interview_questions.html
http://java-questions.com/Threads_interview_questions.html
No comments:
Post a Comment