A.人们往往对自己没有足够的了解
B.人们需要做自己擅长做的事
C.人们应该了解自己的长处
D.人要量力而为
第1题
A.Check()canneverreturntrue.
B.Check()canreturntruewhensetXYiscalledbymultiplethreads.
C.Check()canreturntruewhenmultiplethreadscallsetXandsetYseparately.
D.Check()canonlyreturntrueifSyncTestischangedtoallowxandytobesetseparately.
第2题
A.Check()canneverreturntrue.
B.Check()canreturntruewhensetXYiscalledbymultiplethreads.
C.Check()canreturntruewhenmultiplethreadscallsetXandsetYseparately.
D.Check()canonlyreturntrueifSyncTestischangedtoallowxandytobesetseparately.
第3题
A.Check()canneverreturntrue.
B.Check()canreturntruewhensetXYiscalledbymultiplethreads.
C.Check()canreturntruewhenmultiplethreadscallsetXandsetYseparately.
D.Check()canonlyreturntrueifSyncTestischangedtoallowxandytobesetseparately.
第4题
A.publicclassCircleimplementsShape{privateintradius;}
B.publicabstractclassCircleextendsShape{privateintradius;}
C.publicclassCircleextendsShape{privateintradius;publicvoiddraw();}
D.publicabstractclassCircleimplementsShape{privateintradius;publicvoiddraw();}
E.publicclassCircleextendsShape{privateintradius;publicvoiddraw(){/*codehere*/}}
F.publicabstractclassCircleimplementsShape{privateintradius;publicvoiddraw(){/codehere*/}}
第5题
A.Anerroratline11causescompilationtofail.
B.Errorsatlines7and8causecompilationtofail.
C.Theprogramprintspairsofvaluesforxandythatmightnotalwaysbethesameonthesameline(forexample,“x=2,y=1”)
D.Theprogramprintspairsofvaluesforxandythatarealwaysthesameonthesameline(forexample,“x=1,y=1”.Inaddition,eachvalueappearstwice(forexample,“x=1,y=1”followedby“x=1,y=1”)
E.Theprogramprintspairsofvaluesforxandythatarealwaysthesameonthesameline(forexample,“x=1,y=1”.Inaddition,eachvalueappearstwice(forexample,“x=1,y=1”followedby“x=2s,y=2”)
第6题
A.Compilationfails.
B.Theprogramprintspairsofvaluesforxandythatmightnotalwaysbethesameonthesameline(forexample,“x=2,y=1”).
C.Theprogramprintspairsofvaluesforxandythatarealwaysthesameonthesameline(forexample,“x=1,y=1”). Inaddition,eachvalueappearsonlyonce(forexample,“x=1,y=1”followedby“x=2,y=2”). Thethreadnameatthestartofthelineshowsthatboththreadsareexecutingconcurrently.
D.Theprogramprintspairsofvaluesforxandythatarealwaysthesameonthesameline(forexample,“x=1,y=1”). Inaddition,eachvalueappearsonlyonce(forexample,“x=1,y=1”followedby“x=2,y=2”). Thethreadnameatthestartofthelineshowsthatonlyasinglethreadisactuallyexecuting.
第7题
A.Anerroratline11causescompilationtofail.
B.Errorsatlines7and8causecompilationtofail.
C.Theprogramprintspairsofvaluesforxandythatmightnotalwaysbethesameonthesameline(forexample,“x=2,y=1”)
D.Theprogramprintspairsofvaluesforxandythatarealwaysthesameonthesameline(forexample,“x=1,y=1”.Inaddition,eachvalueappearstwice(forexample,“x=1,y=1”followedby“x=1,y=1”)
E.Theprogramprintspairsofvaluesforxandythatarealwaysthesameonthesameline(forexample,“x=1,y=1”.Inaddition,eachvalueappearstwice(forexample,“x=1,y=1”followedby“x=2s,y=2”)
第8题
A.check()决不能返回true
B.当setXY由多个线程访问时,check()可能返回true
C.当由多个线程分别访问setX和setY时,check()可能返回true
D.只有改变Test使得setX方法对x和y分别赋值,check()才能返回true
第9题
publicclassSyncTest{
publicstaticvoidmain(Stringargs){
finalStringBuffers1=newStringBuffer();
finalStringBuffers2=newStringBuffer();
newThread(){
publicvoidrun(){
synchronized(s1){
s2.append(A”);
synchronized(s2){
s2.append(B”);
System.out.print(s1);
System.out.print(s2);
}
}
}
}.start();
newThread(){
publicvoidrun(){
synchronized(s2){
s2.append(C”);
synchronized(s1){
s1.append(D”);
System.out.print(s2);
System.out.print(s1);
}
}
}
}.start();
}
}
Whichtwostatementsaretrue?()
第10题
classFoo{
privateintx;
publicFoo(intx){this.x=x;}
publicvoidsetX(intx){this.x=x;}
publicintgetX(){returnx;}
}
publicclassGamma{
staticFoofooBar(Foofoo){
foo=newFoo(100);
returnfoo;
}
publicstaticvoidmain(String[]args){
Foofoo=newFoo(300);
System.out.print(foo.getX()+-);
FoofooFoo=fooBar(foo);
System.out.print(foo.getX()+-);
System.out.print(fooFoo.getX()+-);
foo=fooBar(fooFoo);
System.out.print(foo.getX()+-);
System.out.prmt(fooFoo.getX());
}
}
Whatistheoutputofthisprogram?()
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!