🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Lambdas and Functional Interfaces: all 10 questions

Quiz: Lambdas and Functional Interfaces · Question 3 of 10

Which interface is the best fit for (a, b) - a + b on two Integers giving an Integer?

Which interface is the best fit for (a, b) -> a + b on two Integers giving an Integer?

  1. A.UnaryOperator<Integer>
  2. B.BinaryOperator<Integer>
  3. C.Predicate<Integer>
  4. D.Supplier<Integer>
Answer & explanation

Correct answer: BinaryOperator<Integer>

BinaryOperator<T> takes two T values 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 →