A.Thevalue“4”isprintedatthecommandline.
B.Compilationfailsbecauseofanerrorinline5.
C.Compilationfailsbecauseofanerrorinline9.
D.ANullPointerExceptionoccursatruntime.
E.ANumberFormatExceptionoccursatruntime.
F.AnIllegalStateExceptionoccursatruntime.
第1题:
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?()
第2题:
A.Theoutputis“Equal”
B.Theoutputin“NotEqual”
C.Anerroratline5causescompilationtofall.
D.Theprogramexecutesbutdoesnotprintamessage.
第3题:
A.ClassA
B.Compilationfails.
C.Anexceptionisthrownatline2.
D.Anexceptionisthrownatline6.
E.Thecodeexecuteswithnooutput.
第4题:
A.Theprogramrunsandprints“0”
B.Theprogramrunsandprints“1”
C.Theprogramrunsbutabortswithanexception.
D.Anerror“possibleundefinedvariable”atline4causescompilationtofail.
E.Anerror“possibleundefinedvariable”atline9causescompilationtofail.
第5题:
A.0
B.null
C.Compilationfails.
D.ANullPointerExceptionisthrownatruntime.
E.AnArrayIndexOutOfBoundsExceptionisthrownatruntime.