A lock is a tool for controlling access to a shared resource by multiple threads and allows only one thread at a time to execute a region of code.The synchronized keyword allows exclusive locking at the level of a block or method.
Class locks are actually implemented as object locks. When the JVM loads a class file, it creates an instance of class.
An object 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.
For more information,please visit the following link:http://www.roseindia.net/java/thread/SynchronizedThreads.shtml