public void run() {
     try {
        synchronized(this) {
           sleep(10000);
           }
         notifyAll();
        }
      catch(InterruptedException e) {
        }
  }
好像是这样吧!

解决方案 »

  1.   

    class WaitNotify extends Thread{
      public WaitNotify() {
      }
      public synchronized void run() {
        while(true) {
          try {
            wait(1000);
          } catch (InterruptedException e){}
        }
      }
    }class Notifier extends Thread {
      private WaitNotify wn;
      public Notifier(WaitNotify wn) {
        this.wn = wn;
        start();
      }
      public void run() {
        while(true) {
           try {
            sleep(2000);
          } catch (InterruptedException e){}
          synchronized(wn) {
            wn.notify();
          }
        }
      }
    }