Page 1 of 1
About Question enthuware.ocpjp.ii.v11.2.3511 :
Posted: Sat Sep 28, 2019 5:11 am
by sir_Anduin@yahoo.de
interface methods can never be declared final.
small correction:
private methods can be final
Re: About Question enthuware.ocpjp.ii.v11.2.3511 :
Posted: Sat Sep 28, 2019 7:21 am
by admin
Not really. The explanation is clearly talking about interface. Did you try it out?
Re: About Question enthuware.ocpjp.ii.v11.2.3511 :
Posted: Sat Sep 28, 2019 9:01 am
by sir_Anduin@yahoo.de
Yes. And it works.
I mean private methods on interfaces can be final
Re: About Question enthuware.ocpjp.ii.v11.2.3511 :
Posted: Sat Sep 28, 2019 8:54 pm
by admin
What code did you try? The following doesn't compile:
interface X{
private final void m(){ }
}
Re: About Question enthuware.ocpjp.ii.v11.2.3511 :
Posted: Sun Sep 29, 2019 2:39 am
by sir_Anduin@yahoo.de
I appologize, after running it again I saw that it is not compiling. Must have forgotten to save or something like that.
You might delete this thread