wat is class level lock and object level lock

Answer Posted / michael selvan

Class Lock - If a static method is marked as Synchrnozied
and called by a Thread, the whole Class will be locked
until the method execution completed.

Note : If we declare as a any static variables or methods
those will be stored in class area. So, if the method is
synchronized static . It'll lock the complete class.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of StringTokenizer class?

615


Differentiate between a constructor and a method? Can we mark constructors final?

678


What is a copy constructor in java?

582


Is map ordered in java?

537


If I only change the return type, does the method become overloaded?

541






Explain naming conventions for packages?

582


What is the default size of load factor in hashing based collection?

568


When do I need to use reflection feature in java?

627


What is the function of http?

535


5 Coding best practices you learned in java?

640


List the three steps for creating an object for a class?

517


Can we use catch statement for checked exceptions when there is no chance of raising exception in our code?

594


What is the default value of float and double datatype in java?

538


When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?

545


How do listeners work?

517