Which two interfaces are considered to be functional interfaces? (Choose two.)
A.
@FunctionalInterface interface InterfaceC { public boolean equals(Object o); int breed(int x); int calculate(int x, int y); }
B.
@FunctionalInterface interface InterfaceD { int breed(int x); }
C.
@FunctionalInterface interface InterfaceE { public boolean equals(int i); int breed(int x); }
D.
interface InterfaceA { int GERM = 13; public default int getGERM() { return GERM; } }
E.
interface InterfaceB { int GERM = 13; public default int getGERM() { return get(); } private int get() { return GERM; } public boolean equals(Object o); int breed(int x); }
E will not pass as a functional interface since breed(int) is implicitly abstract and public. D can pass as a Functional Interface even if it does not have a single abstract method. B and D are correct.
ANSWERS IS B AND E:
B: Has a only one SAM (single abstract method)
and
E: has a single abstract method, cause default and private methods are not considered abrascts, and EQUALS is a method from OBJECT neither tecnically considered abstract
C: is a triky cause boolean equals(Objetct obj) must be the method from objetc that no count of SAM, every other implementation is count. boolean equals(Integer i); is count Fexmple
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
19980829
3 weeks, 2 days agorey_911
4 months, 2 weeks agoc47d39c
5 months, 3 weeks agod7bb0b2
1 year, 1 month agod7bb0b2
1 year agotmuralimanohar
1 year, 6 months agoStavok
1 year, 7 months agoRP384
1 year, 11 months agoAnkit1010
1 year, 11 months ago