Today I was asked this interview question and could not answer. : If you have two instances of a Person Object and each of them have a setAddres method that is synchronized. Now if it was only one object and multiple threads were accessing it, the nsynchronized will make sure that only one method can access it at a time.
But if there are different objects, one thread will not wait on the other before entering the method.
Now the question is...if I wanted to make the method synchronized across all instances of Person Objects, how to do that?