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