posted 12 years ago
We don't really refer to anything as "being locked." Rather, we say that we obtain a lock. But if by "locking X" you mean "obtaining X's lock", then, yes, you're correct. The object whose lock we obtain is the one whose synchronized method we are executing.
The above methods are equivalent. Both obtain the lock for the "this" object and hold it for the entire body of the method.