← Quiz: Lambdas and Functional Interfaces: all 10 questions
Quiz: Lambdas and Functional Interfaces · Question 2 of 10
Which interface fits a lambda that takes nothing and returns a value?
Which interface fits a lambda that takes nothing and returns a value?
- A.Consumer<T>
- B.Function<T, R>
- C.Supplier<T>
- D.Predicate<T>
Answer & explanation
Correct answer: Supplier<T>
Supplier.get() takes no arguments and returns a T.
Can you get the rest right without peeking?
Take the timed Quiz: Lambdas and Functional Interfaces quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →