← Quiz: static, final and Nested Classes: all 10 questions
Quiz: static, final and Nested Classes · Question 9 of 10
Which can an anonymous class do that a lambda cannot?
Which can an anonymous class do that a lambda cannot?
- A.Use an effectively final local variable
- B.Implement an interface that has two abstract methods
- C.Return a value
- D.Be passed to a method
Answer & explanation
Correct answer: Implement an interface that has two abstract methods
A lambda can only implement a functional interface (one abstract method). An anonymous class can implement any interface or extend a class.
Can you get the rest right without peeking?
Take the timed Quiz: static, final and Nested Classes quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →