@@ -0,0 +1,1265 @@
+package com.hzh.corejava.concurrent.deadlock;%0A%0A/**%0A * Created by huangzehai on 2017/2/17.%0A */%0Apublic class Deadlock %7B%0A    static class Friend %7B%0A        private final String name;%0A%0A        public Friend(String name) %7B%0A            this.name = name;%0A        %7D%0A%0A        public String getName() %7B%0A            return this.name;%0A        %7D%0A%0A        public synchronized void bow(Friend bower) %7B%0A            System.out.format(%22%25s: %25s%22%0A                            + %22  has bowed to me!%25n%22,%0A                    this.name, bower.getName());%0A            bower.bowBack(this);%0A        %7D%0A%0A        public synchronized void bowBack(Friend bower) %7B%0A            System.out.format(%22%25s: %25s%22%0A                            + %22 has bowed back to me!%25n%22,%0A                    this.name, bower.getName());%0A        %7D%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        final Friend alphonse =%0A                new Friend(%22Alphonse%22);%0A        final Friend gaston =%0A                new Friend(%22Gaston%22);%0A        new Thread(new Runnable() %7B%0A            public void run() %7B%0A                alphonse.bow(gaston);%0A            %7D%0A        %7D).start();%0A        new Thread(new Runnable() %7B%0A            public void run() %7B%0A                gaston.bow(alphonse);%0A            %7D%0A        %7D).start();%0A    %7D%0A%7D%0A

Add deadlock example