You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

NestedSynchronized.java 282B

123456789101112131415161718
  1. public class NestedSynchronized {
  2. static Object lockA = new Object();
  3. static Object lockB = new Object();
  4. static int bug() {
  5. synchronized (lockA) {
  6. synchronized (lockB) {
  7. return 0;
  8. }
  9. }
  10. }
  11. public static void main(String[] args) {
  12. bug();
  13. }
  14. }