老师,这里的方法锁锁对象是谁?
来源:7-6 用wait/notify实现

JLU_LONG
2020-04-09
public synchronized void put() {
while (storage.size() == maxSize) {
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
storage.add(new Date());
System.out.println("仓库里有了" + storage.size() + "个产品。");
notify();
}
写回答
1回答
-
this
072020-04-09
相似问题