需要用cInt.notify()cInt.wait().但问题是每次cInt = new Integer(this.cInt.intValue() + 1);上一次的cInt再也找不到了.也就再也醒不过来了.

解决方案 »

  1.   

    int count = 0;
    Object cond = "";
    thread 1:
       synchronized(cond) {
         try{ cond.wait();}catch...
         ...
       }
    thread 2:
         ...
         synchronized(cond) {
            count++;
            cond.notify();
         }
         ...
      

  2.   

    将:
    public abstract class Task {
    public static Integer cInt = new Integer("6");
    }改为:
    public abstract class Task {
    public static int cInt=6;
    }
      

  3.   

    我觉得 amjn(神雕过儿)回答的不对,因为synchronized(Object o),int不是Object.是不是?