欢迎来到天天文库
浏览记录
ID:19862543
大小:69.50 KB
页数:24页
时间:2018-10-07
《java程序员认证模拟题及详细分析》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Java程序员认证模拟题及详细分析二.模拟题1.Whichstatementaboutthegarbagecollectionmechanismaretrue?A.Garbagecollectionrequireadditionalprogramecodeincaseswheremultiplethreadsarerunning.B.Theprogrammercanindicatethatareferencethroughalocalvariableisnolongerofinterest.C.Theprogrammerha
2、samechanismthatexplicityandimmediatelyfreesthememoryusedbyJavaobjects.D.ThegarbagecollectionmechanismcanfreethememoryusedbyJavaObjectatexplectiontime.E.Thegarbagecollectionsystemneverreclaimsmemoryfromobjectswhilearestillaccessibletorunninguserthreads.2.Givethefoll
3、owingmethod:1)publicvoidmethod(){2)Stringa,b;3)a=newString(“helloworld”);4)b=newString(“gameover”);5)System.out.println(a+b+”ok”);6)a=null;7)a=b;8)System.out.println(a);9)}Intheabsenceofcompileroptimization,whichistheearliestpointtheobjectareferedisdefinitelyelibil
4、etobegarbagecollection.A.beforeline3B.beforeline5C.beforeline6D.beforeline7E.Beforeline93.Intheclassjava.awt.AWTEvent,whichistheparentclassuponwhichjdk1.1awteventsarebasedthereisamethodcalledgetIDwhichphraseaccuratelydescribesthereturnvalueofthismethod?A.Itisarefer
5、encetotheobjectdirectlyaffectedbythecauseoftheevent.B.Itisanindicationofthenatureofthecauseoftheevent.C.Itisanindicationofthepositionofthemousewhenitcausedtheevent.D.Inthecaseofamouseclick,itisanindicationofthetextunderthemouseatthetimeoftheevent.E.Ittellsthestateo
6、fcertainkeysonthekeybordatthetimeoftheevent.F.Itisanindicationofthetimeatwhichtheeventoccurred.4.Whichstatementaboutlisteneristrue?A.Mostcomponentallowmultiplelistenerstobeadded.B.Ifmultiplelistenerbeaddtoasinglecomponent,theeventonlyaffectedonelistener.C.Component
7、don?tallowmultiplelistenerstobeadd.D.ThelistenermechanismallowsyoutocallanaddXxxxListenermethodasmanytimesasisneeded,specifyingasmanydifferentlistenersasyourdesignrequire.5.Givethefollowingcode:publicclassExample{publicstaticvoidmain(Stringargs[]){intl=0;do{System.
8、out.println(“Doingitforlis:”+l);}while(--l>0)System.out.println(“Finish”);}}Whichwellbeoutput:A.Doingitforlis3B.Doingitforlis1C.Doingitforlis2D.D
此文档下载收益归作者所有