首页 > 题库 > 学历提升 > 自学考试 > 自考本科 > 案例题

阅读程序,写出该程序的输出结果。
public class Test31 implements Runnable{
private int assignment=6;
public void run(){
while(true){
try{
Thread.sleep(1);
}catch(InterruptedException e){
e.printStackTrace();
}
synchronized(this){
if(assignment>0)
System.out.println(Thread.currentThread().getName()+
":send"+(assignment--)+"# paper");
else
break;
}
}
}
public static void main(String[]args){
Test31t31=new Test31();
new Thread(t31,"T").start();
}
}


参考答案: 查看答案 查看解析 下载APP畅快刷题

相关知识点试题

相关试卷