SCJP题库 希望可以帮助你

SCJP题库 希望可以帮助你

ID:39468103

大小:592.00 KB

页数:21页

时间:2019-07-04

SCJP题库  希望可以帮助你_第1页
SCJP题库  希望可以帮助你_第2页
SCJP题库  希望可以帮助你_第3页
SCJP题库  希望可以帮助你_第4页
SCJP题库  希望可以帮助你_第5页
资源描述:

《SCJP题库 希望可以帮助你》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、yModule1-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.Answer:AD标识符以字母,下划线,或者$开始Q

2、uestion2Given:11.publicclassTest{12.publicstaticvoidmain(String[]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.

3、2B.3C.12D.23E.123F.Compilationfails.G.Anexceptionalisthrownatruntime.Answer:D注意20行,=为赋值,不要被骗Question3Given:42.publicclassClassA{43.publicintgetValue(){44.intvalue=0;45.booleansetting=true;46.Stringtitle="Hello";47.if(value

4、

5、(setting&&title=="Hello")){return1;}48.i

6、f(value==1&title.equals("Hello")){return2;}49.}50.}And:70.ClassAa=newClassA();2171.a.getValue();Whatistheresult?A.1B.2C.Compilationfails.D.Thecoderunswithnooutput.E.Anexceptionisthrownatruntime.Answer:C编译不通过,47行value为int类型不是booleanQuestion4Given:11.publicvoidtestI

7、fA(){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.}WhatistheresultwhenmethodtestIfAisinvoked?A.TrueB.NottrueC.Anexceptionisthrownatruntime

8、.D.Compilationfailsbecauseofanerroratline12.E.Compilationfailsbecauseofanerroratline19.Answer:A19行,如果str为true则返回ture,否则返回falseQuestion5Given:11.publicstaticvoidmain(String[]args){12.Integeri=newInteger(1)+newInteger(2);13.switch(i){14.case3:System.out.println("thr

9、ee");break;15.default:System.out.println("other");break;16.}17.}Whatistheresult?A.threeB.otherC.Anexceptionisthrownatruntime.D.Compilationfailsbecauseofanerroronline12.E.Compilationfailsbecauseofanerroronline13.F.Compilationfailsbecauseofanerroronline15.Answer:A就是

10、两个Integer类型相加Question6Given:11.publicstaticvoidmain(String[]args){12.Stringstr="null";13.if(str==null){14.System.out.println("null");15.}else(str.length

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。