. .
When you synchronize, the monitor is either an object (non-static) or a Class object (static methods).
You have to think about
public synchronized void myMethod(){
...
}
as:
public void myMethod(){
synchronized (this) {
...
}
}
Since you have two independent instances of an object with a synchronized method, you have 2 different monitors. Result: both threads can work simultaneously.
source
share