代码如下 :  objs.get(current++).wait();执行序列是{
    current++;
    objs.get(current).wait();}还是{
   objs.get(current).wait();
   current++;
   线程暂停}还是{
  objs.get(current).wait();
   线程暂停
   线程唤醒
   current++;
}

解决方案 »

  1.   

    我的理解,不返回对象,怎么wait,wait哪个~
      

  2.   

    1.写两个线程,将current包装到一个对象里(作为属性)然后再传入那两个线程。
    2.其中一个线程做current++的操作然后wait时间长点(让另一个线程在它醒来之前有机会读到current)
    3.启动另一个线程去查看current的值。 多做几次就看出来了
      

  3.   


    wait和notify 本来就不是wait的自己,是运行到这的线程
      

  4.   

    objs.get(current++).wait(); 
    等同于
    Object o = objs.get(current);
    current++;
    o.wait();
      

  5.   

    阻塞的是线程本身,可是你wait肯定针对哪个锁对象吧,没返回锁对象,就没东西wait啦