网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
publicclassBoxer1{2.Integeri;3.intx;4.publicBoxer1(inty){5.x=i+y;6.System.out.println(x);7.}8.publicstaticvoidmain(String[]args){9.newBoxer1(newInteger(4));10.}11.}Whatistheresult?()

A.Thevalue“4”isprintedatthecommandline.

B.Compilationfailsbecauseofanerrorinline5.

C.Compilationfailsbecauseofanerrorinline9.

D.ANullPointerExceptionoccursatruntime.

E.ANumberFormatExceptionoccursatruntime.

F.AnIllegalStateExceptionoccursatruntime.


参考答案

更多 “ publicclassBoxer1{2.Integeri;3.intx;4.publicBoxer1(inty){5.x=i+y;6.System.out.println(x);7.}8.publicstaticvoidmain(String[]args){9.newBoxer1(newInteger(4));10.}11.}Whatistheresult?() A.Thevalue“4”isprintedatthecommandline.B.Compilationfailsbecauseofanerrorinline5.C.Compilationfailsbecauseofanerrorinline9.D.ANullPointerExceptionoccursatruntime.E.ANumberFormatExceptionoccursatruntime.F.AnIllegalStateExceptionoccursatruntime. ” 相关考题
考题 1.classA{3.publicStringtoString(){4.return4”;5.}6.}7.classBextendsA{8.publicStringtoString(){9.returnsuper.toString()+3”;10.}11.}12.publicclassTest{13.publicstaticvoidmain(String[]args){14.System.out.printIn(newB());15.}16.}Whatistheresult()?A.Compilationsucceedsand4isprinted.B.Compilation……………isprinted.C.Anerroronline9causecompilationtofail.D.Anerroronline14causecompilationtofail.E.Compilationsucceedsbutanexceptionisthrownatline9.

考题 classHorseRadish{2.//insertcodehere3.protectedHorseRadish(intx){4.System.out.println(bokchoy);5.}6.}7.classWasabiextendsHorseRadish{8.publicstaticvoidmain(String[]args){9.Wasabiw=newWasabi();10.}11.}分别插入到第2行,哪两项允许代码编译并产生bokchoy输出结果?()A.//justacommentB.protectedHorseRadish(){}C.protectedHorseRadish(){this(42);}D.protectedHorseRadish(){newHorseRadish(42);}

考题 public static void main(String[]args){Integer i=new Integer(1)+new Integer(2);switch(i){case3:System.out.println(three);break;default:System.out.println(other);break;}}Whatistheresult?()A.threeB.otherC.Anexceptionisthrownatruntime.D.Compilationfailsbecauseofanerroronline12.E.Compilationfailsbecauseofanerroronline13.F.Compilationfailsbecauseofanerroronline15.

考题 现有:1.classHorseRadish{2.//insertcodehere3.protectedHorseRadish(intx){4.System.out.println(bokchoy);5.}6.}7.classWasabiextendsHorseRadish{8.publicstaticvoidmain(String[]args){9.Wasabiw=newWasabi();10.}11.}分别插入到第2行,哪两项允许代码编译并产生bokchoy输出结果?()A.//justacommentB.protectedHorseRadish(){}C.protectedHorseRadish(){this(42);}D.protectedHorseRadish(){newHorseRadish(42);}

考题 1.publicclassSimpleCalc{2.publicintvalue;3.publicvoidcalculate(){value+=7;}4.}And:1.publicclassMultiCalcextendsSimpleCalc{2.publicvoidcalculate(){value-=3;}3.publicvoidcalculate(intmultiplier){4.calculate();5.super.calculate();6.value*=multiplier;7.}8.publicstaticvoidmain(String[]args){9.MultiCalccalculator=newMultiCalc();10.calculator.calculate(2);11.System.out.println(”Valueis:+calculator.value);12.}13.}Whatistheresult?()

考题 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.Theprogramrunsandprints“1”C.Theprogramrunsbutabortswithanexception.D.Anerror“possibleundefinedvariable”atline4causescompilationtofail.E.Anerror“possibleundefinedvariable”atline9causescompilationtofail.

考题 publicclassIfTest(publicstaticvoidmain(string[]args){intx=3;inty=1;if(x=y)system.out.printIn(Notequal”);elsesystem.out.printIn(Equal”);})Whatistheresult?() A.Theoutputis“Equal”B.Theoutputin“NotEqual”C.Anerroratline5causescompilationtofall.D.Theprogramexecutesbutdoesnotprintamessage.

考题 publicclassTest{privatestaticint[]x;publicstaticvoidmain(String[]args){System.out.println(x[0]);}}Whatistheresult?() A.0B.nullC.Compilationfails.D.ANullPointerExceptionisthrownatruntime.E.AnArrayIndexOutOfBoundsExceptionisthrownatruntime.

考题 publicclassA{2.voidA(){3.System.out.println(ClassA”);4.}5.publicstaticvoidmain(String[]args){6.newA();7.}8.}Whatistheresult?() A.ClassAB.Compilationfails.C.Anexceptionisthrownatline2.D.Anexceptionisthrownatline6.E.Thecodeexecuteswithnooutput.