




如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
SCJP模拟试题一 -------------------------------------------------------------------------------- 此套试题由60道题组成(实际考试为60道题)。 试题由单选题和多选题组成,单选题将提示:Selecttheonerightanswer.,多选题将提示:Selectallvalidanswers.。 实际考试70%为通过,因此您必须在此套模拟试题中答对42题。答案在这儿。 -------------------------------------------------------------------------------- Question1:Giventhefollowingclassdefinition: classA{ protectedinti; A(inti){ this.i=i; } } Whichofthefollowingwouldbeavalidinnerclassforthisclass? Selectallvalidanswers. a) classB{ } b) classBextendsA{ } c) classB{ B(){ System.out.println("i="+i); } } d) classB{ classA{ } } e) classA{ } answer -------------------------------------------------------------------------------- Question2:Whatstatementsaretrueconcerningthemethodnotify()thatisusedinconjunctionwithwait()? Selectallvalidanswers. a)ifthereismorethanonethreadwaitingonacondition,onlythethreadthathasbeenwaitingthelongestisnotified b)ifthereismorethanonethreadwaitingonacondition,thereisnowaytopredictwhichthreadwillbenotifed c)notify()isdefinedintheThreadclass d)itisnotstrictlynecessarytoownthelockfortheobjectyouinvokenotify()for e)notify()shouldonlybeinvokedfromwithinawhileloop answer -------------------------------------------------------------------------------- Question3:Giventhefollowingclass: classCounter{ publicintstartHere=1; publicintendHere=100; publicstaticvoidmain(String[]args){ newCounter().go(); } voidgo(){ //A Threadt=newThread(a); t.start(); } } WhatblockofcodecanyoureplaceatlineAabovesothatthisprogramwillcountfromstartHeretoendHere? Selectallvalidanswers. a) Runnablea=newRunnable(){ publicvoidrun(){ for(inti=startHere;i<=endHere;i++){ System.out.println(i); } } }; b) aimplementsRunnable{ publicvoidrun(){ for(inti=startHere;i<=endHere;i++){ System.out.println(i); } } }; c) Threada=newThread(){ publicvoidrun(){ for(inti=startHere;i<=endHere;i++){ System.out.println(i); } } }; answer --------------------------------------------------------------------------------

ys****39
实名认证
内容提供者


最近下载