现有:classWaitingimplementsRunnable{booleanflag=false;publicsynchronizedvoidrun(){if(flag){flag=false;System.out.print(1);try{this.wait();)catch(Exceptione){}System.out.print(2);}else{flag=true;System.out.print(3);try{Thread.sleep(2000);}catch(Exceptione){}System.out.print(4);notify();}}publicstaticvoidmain(String[]args){Waitingw=newWaiting();newThread(w).start();newThread(w).start();}}以下哪两项是正确的?()
现有:
classWaitingimplementsRunnable{
booleanflag=false;
publicsynchronizedvoidrun(){
if(flag){
flag=false;
System.out.print("1");
try{this.wait();)catch(Exceptione){}
System.out.print("2");
}
else{
flag=true;
System.out.print("3");
try{Thread.sleep(2000);}catch(Exceptione){}
System.out.print("4");
notify();
}
}
publicstaticvoidmain(String[]args){
Waitingw=newWaiting();
newThread(w).start();
newThread(w).start();
}
}
以下哪两项是正确的?()
相关考题:
classWaitingimplementsRunnable{booleanflag=false;publicsynchronizedvoidrun(){if(flag){flag=false;System.out.print(1);try{this.wait();}catch(Exceptione){}System.out.print(2);}else{flag=true;System.out.print(3);try{Thread.sleep(2000);}catch(Exceptione){}System.out.print(4);notify();}}publicstaticvoidmain(String[]args){Waitingw=newWaiting();newThread(w).start();newThread(w).start();}}以下哪两项是正确的?()
【单选题】下列情况中,()属于第一种无形磨损。A.出现了效率更高的同种设备,使现有设备贬值B.由于生产率提高,生产同种设备的社会必要劳动减少,使现有设备贬值C.现有设备生产精度下降,使现有设备贬值D.现有设备生产效率下降,使现有设备贬值