欢迎来到天天文库
浏览记录
ID:52297170
大小:418.33 KB
页数:27页
时间:2020-03-26
《SCJP题库 带达内考点分析②.pdf》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Module2-类、接口以及枚举一、选择题:Question1Given:11.publicinterfaceStatus{12./*insertcodehere*/intMY_VALUE=10;13.}Whichthreearevalidonline12?(Choosethree.)A.finalB.staticC.nativeD.publicE.privateF.abstractG.protectedQuestion2Given:10.classFoo{11.staticvoidalpha(){/*morecodehere*/}12.voidbeta(){/*morecodehere*
2、/}13.}Whichtwoaretrue?(Choosetwo.)A.Foo.beta()isavalidinvocationofbeta().B.Foo.alpha()isavalidinvocationofalpha().C.Methodbeta()candirectlycallmethodalpha().D.Methodalpha()candirectlycallmethodbeta().Question3ClicktheExhibitbutton.11.classPayload{12.privateintweight;13.publicPayload(intwt){weight=
3、wt;}14.publicPayload(){}15.publicvoidsetWeight(mtw){weight=w;}16.publicStringtoString{returnInteger.toString(weight);}17.}18.19.publicclassTestPayload{20.staticvoidchangePayload(Payloadp){21./*insertcodehere*/CopyrightTarenaCorporation,2008.Allrightsreserved22.}23.24.publicstaticvoidmain(String[]a
4、rgs){25.Payloadp=newPayload();26.p.setWeight(1024);27.changePayload(p);28.System.out.println("Thevalueofpis"+p);29.}30.}Whichstatement,placedatline21,causesthecodetoprint“Thevalueofpis420.”?A.p.setWeight(420);B.p.changePayload(420);C.p=newPayload(420);D.Payload.setWeight(420);E.p=Payload.setWeight
5、(420);F.p=newPayload();p.setWeight(420);Question4ClicktheExhibitbutton.1.publicclassItem{2.privateStringdesc;3.publicStringgetDescription(){returndesc;}4.publicvoidsetDescription(Stringd){desc=d;}5.6.publicstaticvoidmodifyDesc(Itemitem,Stringdesc){7.item=newItem();8.item.setDescription(desc);9.}10
6、.publicstaticvoidmain(String[]args){11.Itemit=newItem();12.it.setDescription("Gobstopper");13.Itemit2=newItem();14.it2.setDescription("Fizzylifting");15.modifyDesc(it,"Scrumdiddlyumptious");16.System.out.println(it.getDescription());17.System.out.println(it2.getDescription());18.}19.}Whatistheoutc
7、omeofthecode?A.Compilationfails.B.GobstopperFizzyliftingCopyrightTarenaCorporation,2008.AllrightsreservedC.GobstopperScrumdiddlyumptiousD.ScrumdiddlyumptiousFizzylifltngE.ScrumdiddlyumptiousScrumdiddlyumptiousQue
此文档下载收益归作者所有