public void g() { synchronized (syncObject) { for (int i = 0; i < 5; i++) { print("g()"); Thread.yield(); } } }
public synchronized void f() { for (int i = 0; i < 5; i++) { print("f()"); Thread.yield(); } }