LearnFrenzy
Sign in Take a free test

Lambda Expressions · Lambda Expressions MCQ · Question 19

A curried function Answer, explanation & discussion

  • MCQ
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
Question 19 Back to Exercise

Given Function<Integer, Function<Integer, Integer>> add = a -> b -> a + b;, how do you compute 2 + 3?

  • A add.apply(2, 3)
  • B add.apply(2).apply(3) Correct
  • C add(2)(3)
  • D add.apply(3).get(2)
Correct Answer: Option B

add.apply(2) returns a function that adds 2.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links