题目内容

publicclassTwoThreads{
privatestaticObjectresource=newObject();
privatestaticvoiddelay(longn){
try{Thread.sleep(n);}
catch(Exceptione){System.out.print(”Error);}
}
publicstaticvoidmain(String[]args){
System.out.print(”StartMain);
newThread1().start();
delay(1000);
Threadt2=newThread2();
t2.start();
delay(1000);
t2.interrupt
delay(1000);
System.out.print(”EndMain);
}
staticclassThread1extendsThread{
publicvoidrun(){
synchronized(resource){
System.out.print(”Startl);
delay(6000);
System.out.print(”End1);
}
}
}
staticclassThread2extendsThread{
publicvoidrun(){
synchronized(resource){
System.out.print(”Start2);
delay(2000);
System.out.print(”End2);
}
}
}
}
Assumethatsleep(n)executesinexactlymmilliseconds,andallothercodeexecutesinaninsignificantamountoftime.Whatistheoutputifthemain()methodisrun?()

查看答案
更多问题

一次申请,多次使用的贷款叫做()。

A. 间接贷款
B. 分期偿还贷款
C. 循环贷款
D. 一次性偿还贷款

企业信用评级 名词解释

权利质押 名词解释

AssumingthattheserializeBanana2()andthedeserializeBanana2()methodswillcorrectlyuseJavaserializationandgiven:
importjava.io.*;
classFood{Food(){System.out.print(”1”);}}
classFruitextendsFoodimplementsSerializable{
Fruit(){System.out.print(”2”);}}
publicclassBanana2extendsFruit{intsize=42;
publicstaticvoidmain(String[]args){
Banana2b=newBanana2();
b.serializeBanana2(b);//assumecorrectserialization
b=b.deserializeBanana2(b);//assumecorrect
System.out.println(”restored+b.size+);}
//moreBanana2methods
}
Whatistheresult?()

答案查题题库