I’m reading a book regarding to the OCPJP exam. It says
An entire method can be declared synchronized. In that case, when the method declared as synchronized is called, a lock is obtained on the object on which the method is called, and it is releases when the method returns to the caller.
What I got from this phrase;
If there is a class called A, which calls a synchronized method, resides in the class B, is acquiring the lock from an object of class A (which the method is called).
Is it correct or not?
Does it need to acquire the lock from an object of class B? Just like synchronized block using this reference.