10黑马币
最佳答案public class Demo9 {
public static void main(String[] args) {
SendPaper sp = new SendPaper();
new Thread(sp, "李老师").start();
new Thread(sp, "张老师").start();
new Thread(sp, "林老师").start();
}
}
class SendPaper implements Runnable{
private int num = 100;
@Override
public void run() {
while(true){
synchronized ("锁") {
if(num == 1){
if("李老师".equals(Thread.current ...
| |
| |
| |
| |