Page 1 of 1

About Question enthuware.ocpjp.v11.2.3655 :

Posted: Tue Apr 06, 2021 7:52 am
by syzygy
It should be noted, that the val-- after the inner class is also illegal, so if you just change the inner class to

Code: Select all

public int reduce(int mval) {
    return mval - val;
}
it still fails to compile

Re: About Question enthuware.ocpjp.v11.2.3655 :

Posted: Tue Apr 06, 2021 8:22 am
by admin
Actually, val-- after the inner class is not illegal. Using val inside the inner class if there is val-- after the innerclass is illegal (because val wouldn't remain effectively final if you do val-- after the inner class).
Noted.
thank you for your feedback!