Why is `synchronized (new Object()) {}` a no-op?
问题 In the following code: class A { private int number; public void a() { number = 5; } public void b() { while(number == 0) { // ... } } } If method b is called and then a new thread is started which fires method a, then method b is not guaranteed to ever see the change of number and thus b may never terminate. Of course we could make number volatile to resolve this. However for academic reasons let's assume that volatile is not an option: The JSR-133 FAQs tells us: After we exit a synchronized