欢迎来到天天文库
浏览记录
ID:36230870
大小:166.50 KB
页数:49页
时间:2019-05-07
《sds-三氯化磷》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、1.Given:1.publicclasstest(2.publicstaticvoidmain(Stringargs[]){3.inti=0xFFFFFFF1;4.intj=~i;5.6.}7.)Whatisthedecimalvalueofjatline5?A.0B.1C.14D.-15E.Anerroratline3causescompilationtofail.F.Anerroratline4causescompilationtofail.C2.Given:Integeri=newInteger(42);Long1=ne
2、wLong(42);Doubled=newDouble(42.0);WhichtwoexpressionsevaluatetoTrue?(ChooseTwo)A.(i==1)B.(i==d)C.(d==1)D.(i.equals(d))E.(d.equals(i))F.(i.equals(42))3.Clicktheexhibitbutton:1.publicclasstest(2.privatestaticintj=0;3.4.privatestaticbooleanmethodB(intk)(5.j+=k;6.returnt
3、rue;7.)8.9.publicstaticvoidmethodA(inti){10.booleanb;11.b=i<10
4、methodB(4);12.b=i<10
5、
6、methodB(8);13.)14.15.publicstaticvoidmain(Stringargs[]}(16.methodA(0);17.system.out.printIn(j);18.)19.)Whatistheresult?A.Theprogramprints“0”B.Theprogramprints“4”C.Theprogramprints“8”
7、D.Theprogramprints“12”E.ThecodedoesnotcompleteB4.Given:1.Publicclasstest(2.Publicstaticvoidmain(Stringargs[])(3.System.out.printIn(6^3);4.)5.)Whatistheoutput?Ans:55.Given:1.publicclassFoo{2.publicstaticvoidmain(String[]args){3.StringBuffera=newStringBuffer(“A”);4.Str
8、ingBufferb=newStringBuffer(“B”);5.operate(a,b);6.system.out.printIn{a+“,”+b};7.)8.staticvoidoperate(StringBufferx,StringBuffery){9.x.append{y};10.y=x;11.)12.}Whatistheresult?A.Thecodecompilesandprints“A,B”.B.Thecodecompilesandprints“A,A”.C.Thecodecompilesandprints“B,
9、B”.D.Thecodecompilesandprints“AB,B”.E.Thecodecompilesandprints“AB,AB”.F.Thecodedoesnotcompilebecause“+”cannotbeoverloadedforStringBuffer.D6.Clicktheexhibitbutton:1.Publicclasstest(2.PublicstaticvoidstringReplace(Stringtext)(3.Text=text.replace(‘j’,‘i’);4.)5.6.publics
10、taticvoidbufferReplace(StringBuffertext)(7.text=text.append(“C”)8.)9.10.publicstaticvoidmain(Stringargs[]}(11.StringtextString=newString(“java”);12.StringBuffertextBufferString=newStringBuffer(“java”);13.14.stringReplace(textString);15.BufferReplace(textBuffer);16.17
11、.System.out.printIn(textString+textBuffer);18.}19.)Whatistheoutput?Ans:javajavac7.ClicktheExhibitbutton:1.publicclasstest{2.publics
此文档下载收益归作者所有