欢迎来到天天文库
浏览记录
ID:38732361
大小:88.00 KB
页数:20页
时间:2019-06-18
《一些SCJP考试题含答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、一些SCJP考试题含答案LeadingthewayinITtestingandcertificationtools,QUESTIONNO:92Given:1.Stringfoo=“blue”;2.Boolean[]bar=newBoolean[1];3.if(bar[0]){4.foo=“green”;5.}Whatistheresult?A.Foohasthevalueof“”B.Foohasthevalueofnull.C.Foohasthevalueof“blue”D.Foohasthevalueof“green”E.
2、Anexceptionisthrown.F.Thecodewillnotcompile.Answer:FQUESTIONNO:93Exhibit:1.publicclassX{2.publicstaticvoidmain(String[]args){3.Strings1=newString(“true”);4.Booleanb1=newBoolean(true);5.if(s2.equals(b1)){6.System.out.printIn(“Equal”);7.}8.}9.}Whatistheresult?A.Thepr
3、ogramrunsandprintsnothing.B.Theprogramrunsandprints“Equal”C.Anerroratline5causescompilationtofail.D.Theprogramrunsbutabortswithanexception.Answer:AQUESTIONNO:94Given:1.publicclassFoo{2.publicstaticvoidmain(String[]args){3.inti=1;4.intj=i++;5.if((i>++j)&&
4、(i++==j)){6.i+=j;7.}8.}9.}Whatisthefinalvalueofi?A.1B.2C.3D.4E.5Answer:BQUESTIONNO:95Exhibit:1.publicclassX{2.publicstaticvoidmain(String[]args){3.strings=newstring(“Hello”);4.modify(s);5.System.out.printIn(s);6.}7.8.publicstaticvoidmodify(Strings){9.s+=“world!”;10
5、.}11.}Whatistheresult?E.Theprogramrunsandprints“Hello”F.Anerrorcausescompilationtofail.G.Theprogramrunsandprints“Helloworld!”H.Theprogramrunsbutabortswithanexception.Answer:AQUESTIONNO:96Whichtwoareequivalent?(ChooseTwo)A.16>4B.16/2C.16*4D.16>>2E.16/2^2F.1
6、6>>>2Answer:D,EQUESTIONNO:97Exhibit:1.publicclassX{2.publicstaticvoidmain(String[]args){3.int[]a=newint[1]4.modify(a);5.System.out.printIn(a[0]);6.}7.8.publicstaticvoidmodify(int[]a){9.a[0]++;10.}11.}Whatistheresult?A.Theprogramrunsandprints“0”B.Theprogram
7、runsandprints“1”C.Theprogramrunsbutabortswithanexception.D.Anerror“possibleundefinedvariable”atline4causescompilationtofail.E.Anerror“possibleundefinedvariable”atline9causescompilationtofail.Answer:BQUESTIONNO:98Given:13.publicclassFoo{14.publicstaticvoidmain(Strin
8、g[]args){15.StringBuffera=newStringBuffer(“A”);16.StringBufferb=newStringBuffer(“B”);17.operate(a,b);18.system.out.printIn{a+“,”+b};19.)20.static
此文档下载收益归作者所有