The post-Revolution government did not want women to read or write in any language.
A.真
B.假
C.NOT GIVEN
第1题
A.0,0,0
B.150,60,0
C.Compilationfails.
D.150,150,150
E.Anexceptionisthrownatruntime.
第2题
A.peep
B.bark
C.meow
D.Compilationfails.
E.Anexceptionisthrownatruntime.
第3题
A.p0=p1;
B.p1=p2;
C.p2=p4;
D.p2=(ClassC)p1;
E.p1=(ClassB)p3;
F.p2=(ClassC)p4;
第4题
A.Itcanbeanyclass.
B.Noclasshasaccesstobase.
C.Theclassmustbelongtothegeometrypackage.
D.TheclassmustbeasubclassoftheclassHypotenuse.
第5题
A.Line4ofclassTargetcanbechangedtoreturni++;
B.Line2ofclassTargetcanbechangedtoprivateinti=1;
C.Line3ofclassTargetcanbechangedtoprivateintaddOne(){
D.Line2ofclassTargetcanbechangedtoprivateIntegeri=0;
第6题
A.anyclass
B.onlytheTargetclass
C.anyclassinthetestpackage
D.anyclassthatextendsTarget
第7题
A.foo.notify();
B.bar.notify();
C.foo.notifyAll();
D.Thread.notify();
E.bar.notiFYAll();
F.Object.notify();
第8题
A.ThiscodemaythrowanInterruptedException.
B.ThiscodemaythrowanIllegalStateException.
C.ThiscodemaythrowaTimeoutExceptionaftertenminutes.
D.Thiscodewillnotcompileunless“obj.wait()”isreplacedwith“((Thread)obj).wait()”.
E.Reversingtheorderofobj.wait()andobj.notify()maycausethismethodtocompletenormally.
F.Acalltonotify()ornotifyAll()fromanotherthreadmaycausethismethodtocompletenormally.
第9题
privateintnum;
privatebooleanisComplete;
privateintresult;
publicComputation(intnum){this.num=num;}
publicsynchronizedvoidrun(){
result=num*2;
isComplete=true;
notify();
}
publicsynchronizedintgetResult(){
while(!isComplete){
try{
wait();
}catch(InterruptedExceptione){}
}
returnresult;
}
publicstaticvoidmain(String[]args){
Computation[]computations=newComputation[4];
for(inti=0;i<computations.length;i++){
computations[i]=newComputation(i);
computations[i].start();
}
for(Computationc:computations)
System.out.print(c.getResult()+);
}
}
Whatistheresult?()
第10题
publicstaticvoidmain(String[]args)throwsException{
Recordr1=newRecord();
Recordr2=newRecord();
doTransfer(r1,r2,5);
doTransfer(r2,r1,2);
doTransfer(r1,r2,1);
//printtheresult
System.out.println(”rl=+r1.get()+,r2=”+r2.get());
}
privatestaticvoiddoTransfer(
finalRecorda,finalRecordb,finalintamount){
Threadt=newThread(){
publicvoidrun(){
newClerk().transfer(a,b,amount);
}
};
t.start();
}
}
classClerk{
publicsynchronizedvoidtransfer(Recorda,Recordb,intamount){
synchronized(a){
synchronized(b){
a.add(-amount);
b.add(amount);
}
}
}
}
classRecord{
intnum=10;
publicintget(){returnnum;}
publicvoidadd(intn){num=num+n;}
}
IfTransfers.main()isrun,whichthreearetrue?()
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!