← 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?
- A.UnaryOperator<Integer>
- B.BinaryOperator<Integer>
- C.Predicate<Integer>
- 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 →