欢迎来到天天文库
浏览记录
ID:53008841
大小:557.89 KB
页数:24页
时间:2020-04-11
《SCJP题库 带达内考点分析①.pdf》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Module1-JAVA基础一、选择题:Question1Given:35.String#name="JaneDoe";36.int$age=24;37.Double_height=123.5;38.double~temp=37.5;Whichtwoaretrue?(Choosetwo.)A.Line35willnotcompile.B.Line36willnotcompile.C.Line37willnotcompile.D.Line38willnotcompile.Question2Given:11.publicclassTest{12.publicstaticvoidmain(Stri
2、ng[]args){13.intx=5;14.booleanb1=true;15.booleanb2=false;16.17.if((x==4)&&!b2)18.System.out.print("l");19.System.out.print("2");20.if((b2=true)&&b1)21.System.out.print("3");22.}23.}Whatistheresult?A.2B.3C.12D.23E.123F.Compilationfails.G.Aexceptionalisthrownatruntime.CopyrightTarenaCorporation,2009.
3、AllrightsreservedQuestion3Given:42.publicclassClassA{43.publicintgetValue(){44.intvalue=0;45.booleansetting=true;46.Stringtitle="Hello";47.if(value
4、
5、(setting&&title=="Hello")){return1;}48.if(value==1&title.equals("Hello")){return2;}49.}50.}And:70.ClassAa=newClassA();71.a.getValue();Whatistheresult?
6、A.1B.2C.Compilationfails.D.Thecoderunswithnooutput.E.Anexceptionisthrownatruntime.Question4Given:11.publicvoidtestIfA(){12.if(testIfB("True")){13.System.out.println("True");14.}else{15.System.out.println("Nottrue");16.}17.}18.publicBooleantestIfB(Stringstr){19.returnBoolean.valueOf(str);20.}Whatist
7、heresultwhenmethodtestIfAisinvoked?A.TrueB.NottrueC.Anexceptionisthrownatruntime.D.Compilationfailsbecauseofanerroratline12.E.Compilationfailsbecauseofanerroratline19.CopyrightTarenaCorporation,2009.AllrightsreservedQuestion5Given:11.publicstaticvoidmain(String[]args){12.Integeri=newInteger(1)+newI
8、nteger(2);13.switch(i){14.case3:System.out.println("three");break;15.default:System.out.println("other");break;16.}17.}Whatistheresult?A.threeB.otherC.Anexceptionisthrownatruntime.D.Compilationfailsbecauseofanerroronline12.E.Compilationfailsbecauseofanerroronline13.F.Compilationfailsbecauseofanerro
9、ronline15.Question6Given:11.publicstaticvoidmain(String[]args){12.Stringstr="null";13.if(str==null){14.System.out.println("null");15.}else(str.length()==0){16.System.out.println("zero");17.}else{18.System.o
此文档下载收益归作者所有