I\'m learning about deadlocks in Java, and there\'s this sample code from Sun\'s official tutorial:
Alphonse and Gaston are friends, and great belie
I'd have to double check, but I think a synchronized method locks on the class object, so it locks out other synchronized methods in the same class.
I think it locks on the class object itself, so it even blocks different instances.
Edit to add:
Take a look at this part of the java language spec
Each bow method grabs it's own objects monitor. Both then try to call the other object's bow back, and block waiting for the other monitor.