幻灯片1SCJP6.0AlbertChu幻灯片2001AD35.String#name=JaneDoe;36.int$age=24;37.Double_height=123.5;38.double~temp=37.5;Whichtwostatementsaretrue?(Choosetwo.)A.Line35willnotcompile.B.Line36willnotcompile.C.Line37willnotcompile.D.Line38willnotcompile.幻灯片3002D1.publicclassTestString1{2.publicstaticvoidmain(String[]args){3.Stringstr=420;4.str+=42;5.System.out.print(str);6.}7.}Whatistheoutput?A.42B.420C.462D.42042E.Compilationfails.F.Anexceptionisthrownatruntime.幻灯片4003D1.publicclassTest{2.publicstaticvoidmain(String[]args){3.intx=5;4.booleanb1=true;5.booleanb2=false;6.7.if((x==4)&&!b2)8.System.out.print(1);9.System.out.print(2);10.if((b2=true)&&b1)11.System.out.print(3);12.}13.}Whatistheresult?A.2B.3C.12D.23E.123F.Compilationfails.G.Anexceptionisthrownatruntime.幻灯片5004C22.publicvoidgo(){23.Stringo=;24.z:25.for(intx=0;x3;x++){26.for(inty=0;y2;y++){27.if(x==1)break;28.if(x==2&&y==1)breakz;29.o=o+x+y;30.}31.}32.System.out.println(o);33.}Whatistheresultwhenthego()methodisinvoked?A.00B.0001C.000120D.00012021E.Compilationfails.F.Anexceptionisthrownatruntime.幻灯片6005B10.intx=0;11.inty=10;12.do{13.y--;14.++x;15.}while(x5);16.System.out.print(x+,+y);Whatistheresult?A.5,6B.5,5C.6,5D.6,6幻灯片7006G1.publicclassBreaker{2.staticStringo=;3.publicstaticvoidmain(String[]args){4.z:5.o=o+2;6.for(intx=3;x8;x++){7.if(x==4)break;8.if(x==6)breakz;9.o=o+x;10.}11.System.out.println(o);12.}13.}Whatistheresult?A.23B.234C.235D.2345E.2357F.23457G.Compilationfails.幻灯片8007B1.publicclassBreaker2{2.staticStringo=;3.publicstaticvoidmain(String[]args){4.z:5.for(intx=2;x7;x++){6.if(x==3)continue;7.if(x==5)breakz;8.o=o+x;9.}10.System.out.println(o);11.}12.}Whatistheresult?幻灯片9008E1.publicclassSpock{2.publicstaticvoidmain(String[]args){3.Longtail=2000L;4.Longdistance=1999L;5.Longstory=1000L;6.if((taildistance)^((story*2)==tail))7.System.out.print(1);8.if((distance+1!=tail)^((story*2)==distance))9.System.out.print(2);10.}11.}Whatistheresult?A.2B.24C.234D.246E.2346F.Compilationfails.幻灯片10009D11.String[]elements={for,tea,too};12.Stringfirst=(elements.length0)?elements[0]:null;Whatistheresult?A.Compilationfails.B.Anexceptionisthrownatruntime.C.Thevariablefirstissettonull.D.Thevariablefirstissettoelements[0].幻灯片11010C1.importjava.util.*;2.publicclassQuest{3.publicstaticvoidmain(String[]args){4.String[]colors=5.{blue,red,green,yellow,orange};6.Arrays.sort(colors);7.ints2=Arrays.binarySearch(colors,orange);8.ints3=Arrays.binarySearch(colors,violet);9.System.out.print(s2++s3);10.}11.}Whatistheresult?A.1B.2C.12D.Compilationfails.E.Nooutputisproduced.F.Anexceptionisthrownatruntime.幻灯片12011E1.classAlligator{2.publicstaticvoidmain(String[]args){3.int[]x[]={{1,2},{3,4,5},{6,7,8,9}};4.int[][]y=x;5.System.out.print(y[2][1]);6.}7.}Whatistheresult?幻灯片13012A.2-1B.2-4C.2-5D.3-1E.3-4F.3-5G.Compilationfails.H.Anexceptionisthrownatruntime.A.2B.3C.4D.6E.7F.Compilationfails.幻灯片14013D1.publicclassBarn{2.publicstaticvoidmain(String[]args){3.newBarn.go(hi,1);4.newBarn.go(hi,world,2);5.}6.publicvoidgo(String...y,intx){7.System.out.print(y[y.length-1]+);8.}9.}Whatistheresult?幻灯片15014D11.classPerson{12.Stringname=Noname;13.publicPerson(Stringnm){name=nm;}14.}15.16.classEmployeeextendsPerson{17.StringempID=0000;18.publicEmployee(Stringid){empID=id;}19.}20.21.classEmployeeTest{22.publicstaticvoidmain(String[]args){23.Employeee=newEmployee(4321);24.System.out.println(e.empID);25.}26.}Whatistheresult?幻灯片16015D11.classMud{12.//insertcodehere13.System.out.println(hi);A.hihiB.hiworldC.worldworldD.Compilationfails.E.Anexceptionisthrownatruntime.A.4321B.0000C.Anexceptionisthrownatruntime.D.Compilationfailsbecauseofanerrorinline18.14.}15.}Andthefollowingfivefragments:publicstaticvoidmain(String...a){//rpublicstaticvoidmain(String.*a){publicstaticvoidmain(String...a){//rpublicstaticvoidmain(String[]...a){//rpublicstaticvoidmain(String...[]a){Howmanyofthecodefragments,insertedindependentlyatline12,compile?幻灯片170165.classAtom{6.Atom(){System.out.print(atom);}7.}8.classRockextendsAtom{9.Rock(Stringtype){System.out.print(type);}10.}11.publicclassMountainextendsRock{12.Mountain(){13.super(granite);14.newRock(granite);15.}16.publicstaticvoidmain(String[]a){newMountain();}17.}Whatistheresult?FA.0B.1C.2D.3E.4F.5幻灯片18017ACEFG1.publicclassBlip{2.protectedintblipvert(intx){return0;}3.}4.classVertextendsBlip{5.//insertcodehere6.}Whichfivemethods,insertedindependentlyatline5,willcompile?(Choosefive.)幻灯片19018CD1.classSuper{2.privateinta;3.protectedSuper(inta){this.a=a;}4.}...11.classSubextendsSuper{12.publicSub(inta){super(a);}A.Compilationfails.B.atomgraniteC.granitegraniteD.atomgranitegraniteE.Anexceptionisthrownatruntime.F.atomgraniteatomgraniteA.publicintblipvert(intx){return0;}B.privateintblipvert(intx){return0;}C.privateintblipvert(longx){return0;}D.protectedlongblipvert(intx){return0;}E.protectedintblipvert(longx){return0;}F.protectedlongblipvert(longx){return0;}G.protectedlongblipvert(intx,inty){return0;}13.publicSub(){this.a=5;}14.}Whichtwo,independently,willallowSubtocompile?(Choosetwo.)幻灯片20019DWh