举一个别人的例子: public class DeadlockDemo implements Runnable{ DeadlockDemo grabIt; public static void main(String[] args) { DeadlockDemo d1=new DeadlockDemo(); DeadlockDemo d2=new DeadlockDemo(); Thread t1=new Thread(d1); Thread t2=new Thread(d2); d1.grabIt=d2; d2.grabIt=d1; t1.start(); t2.start(); System.out.println("已启动"); try { t1.join(); t2.join(); } catch(InterruptedException e){ System.out.println("发生错误"); } System.exit(0); } public synchronized void run() { try{ Thread.sleep(500); } catch(InterruptedException e){ System.out.println("发生错误"); } grabIt.syncIt(); } public synchronized void syncIt() { try{ Thread.sleep(500); System.out.println("同步"); } catch(InterruptedException e) { System.out.println("发生错误"); } System.out.println("在synchIt()方法中"); } } 1.其中涉及动三个线程1.mian 2.t1 3.t2 当其中一个线程执行时其他线程就被对象锁锁住,但是在当前线程调用其他的线程的对象是就会发生死锁,因为对象锁一直不放。所以死锁