← Quiz: Nested and Anonymous Classes: all 10 questions
Quiz: Nested and Anonymous Classes · Question 7 of 10
Which of these CANNOT be implemented with a lambda?
Which of these CANNOT be implemented with a lambda?
- A.
Runnable - B.
Comparator<String> - C.An interface with two abstract methods
- D.
java.util.function.Predicate<Integer>
Answer & explanation
Correct answer: An interface with two abstract methods
A lambda can only implement a functional interface: exactly one abstract method.
Can you get the rest right without peeking?
Take the timed Quiz: Nested and Anonymous Classes quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →