wait()是释放锁,然后挂起当前线程。 notify()是通知挂起线程重新执行 wait()和notify()都应该是在synchronized代码块中使用 (个人理解,不一定下确) 测试代码: package com.hyliu; import java.util.Date; public class SimpleTest { public static void main(String[] args) throws Exception { Object k = new Object(); synchronized (k) { MyRun r = new MyRun(k); Thread t = new Thread(r); print("1"); t.start(); print("2"); try { Thread.currentThread().sleep(10000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } k.wait(); print("3"); } } public static class MyRun implements Runnable{ Object obj ; public MyRun(Object o){ obj = o; } public void run() { // TODO Auto-generated method stub synchronized (obj) { try { Thread.currentThread().sleep(10000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } print("11"); obj.notify(); try { Thread.currentThread().sleep(10000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } print("12"); } } } public static void print(String str) { System.out.println(new Date() + "###" + str); } }