Page 1 of 1

About Question enthuware.ocpjp.ii.v11.2.3501 :

Posted: Mon Aug 05, 2019 3:48 pm
by huangfeng212
In the first option, the interface is not a functional interface and because of the exitance of @FunctionalInterface on it, the compilation will fail.

Re: About Question enthuware.ocpjp.ii.v11.2.3501 :

Posted: Mon Aug 05, 2019 6:27 pm
by admin
Correct, that is why it is not a correct option. The explanation below this option says the same.

Re: About Question enthuware.ocpjp.ii.v11.2.3501 :

Posted: Sat Apr 17, 2021 7:12 am
by gcamaraomarques
The explanation correctly states that interface A is invalid.

Following that, why is AA a valid option?

Re: About Question enthuware.ocpjp.ii.v11.2.3501 :

Posted: Sat Apr 17, 2021 8:15 am
by admin
The explanation already explains this:
Although there is no @FunctionalInterface annotation on this interface, it has exactly one abstract method and is, therefore, a valid functional interface.

and also says at the end:

It is not necessary to apply the @FunctionalInterface annotation to a functional interface but it is recommended to do so because doing so enables IDEs and compilers to generate error message if the interface does not satisfy the requirements of functional interface.

Re: About Question enthuware.ocpjp.ii.v11.2.3501 :

Posted: Thu Dec 19, 2024 4:30 am
by raphaelzintec
its amazing how i make silly errors but i know them

@FunctionalInterface interface A{ static void m1(){}; }

i got distracted by the annotation, very good job