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?()

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?()


相关考题: