This content has been marked as final. Show 2 replies
Shortly put, the synchronized(object) doesn't lock the object reference in any way. It locks the code inside the synchronized's brackets, so that code can run it only when they have locked object (or in truth, when they have acquired object's monitor).
Since only one thread at a time can lock an object (obtain an object's monitor), this means that 2 threads executing blocks that synchronize on the same object can't run at the same time, ensuring thread safety (among other things).