About Question enthuware.ocpjp.v17.2.3726 :
Posted: Fri Jun 09, 2023 4:07 pm
In this question we have:
class A extends Base{
@Override
int power(){ // Class A method power returning "0"
return 0;
}
}
if(base instanceof A a && a.power() == 1 ){ //
((AA)a).mAA();
}
In the IF above...
How can I have "a.power() == 1" in the If-Conditional above as TRUE, and therefore entering in the conditional and executing ((AA)a).mAA(),
if in the "Class A" the method power return 0???
class A extends Base{
@Override
int power(){ // Class A method power returning "0"
return 0;
}
}
if(base instanceof A a && a.power() == 1 ){ //
((AA)a).mAA();
}
In the IF above...
How can I have "a.power() == 1" in the If-Conditional above as TRUE, and therefore entering in the conditional and executing ((AA)a).mAA(),
if in the "Class A" the method power return 0???