About Question enthuware.ocpjp.ii.v11.2.3501 :
Moderator: admin
-
- Posts: 1
- Joined: Mon Aug 05, 2019 3:47 pm
- Contact:
About Question enthuware.ocpjp.ii.v11.2.3501 :
In the first option, the interface is not a functional interface and because of the exitance of @FunctionalInterface on it, the compilation will fail.
Online
-
- Site Admin
- Posts: 10383
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3501 :
Correct, that is why it is not a correct option. The explanation below this option says the same.
-
- Posts: 1
- Joined: Sat Apr 17, 2021 7:07 am
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3501 :
The explanation correctly states that interface A is invalid.
Following that, why is AA a valid option?
Following that, why is AA a valid option?
Online
-
- Site Admin
- Posts: 10383
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3501 :
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.
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.
-
- Posts: 167
- Joined: Sun Apr 21, 2024 10:43 am
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3501 :
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
@FunctionalInterface interface A{ static void m1(){}; }
i got distracted by the annotation, very good job
Who is online
Users browsing this forum: admin and 5 guests