Page 1 of 1

About Question enthuware.ocpjp.v21.2.3726 :

Posted: Fri Sep 19, 2025 2:45 pm
by giginar
Hello,

((AA)a).mAA(); will throw classCastException, right? But I am guessing since a.power() is not equals to 1, it will not execute the if block, so we are safe?

Re: About Question enthuware.ocpjp.v21.2.3726 :

Posted: Sat Sep 20, 2025 12:45 am
by admin
No, why do you think ((AA)a).mAA(); will throw ClassCastException? The code doesn't show any call to TestClass's processBase(Base base) method.