🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Supplier
  2. B.Function
  3. C.Predicate
  4. 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 →