Java Interview Questions and Answers

 

What is an object's lock and which object's have locks in Java Programming?

An objectís lock is a mechanism that is used by multiple threads to obtain synchronized
access to the object. A thread may execute a synchronized method of an object only
after it has acquired the objectís lock. All objects and classes have locks. A classís
lock is acquired on the classís Class object.

Posted by:Richards