← Quiz: Java 8 Lambdas and Streams: all 10 questions
Quiz: Java 8 Lambdas and Streams · Question 8 of 10
Which functional interface takes a value and returns nothing?
Which functional interface takes a value and returns nothing?
- A.Supplier
- B.Function
- C.Predicate
- D.Consumer
Answer & explanation
Correct answer: Consumer
Consumer.accept(T) returns void, like System.out::println. Supplier is the opposite: it takes nothing and returns a value.
Can you get the rest right without peeking?
Take the timed Quiz: Java 8 Lambdas and Streams quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →