syncronized(this) { //把wait代码放在synchronized块中,锁线程自己 wait(1000); //锁一定的时间,要不然没有notify就一直wait了 }
62,630
社区成员
307,263
社区内容
加载中
试试用AI创作助手写篇文章吧