Oracle Certified Associate Java Se 8 Programmer · Free Practice Question Easy
Question 43
Consider below Lambda expression:
Predicate predicate = s -> true;
Which of the lambda expression can successfully replace the lambda expression in above statement?
-
A
s -> {true;} -
B
s -> {return true} -
C
s -> {true} -
D
s -> {return true;}
Reveal correct answer
Correct answer: D
Explanation
In the lambda expression's body, if used, all 3 [return, {}, ;] must be used together.Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
You must be logged in to post a comment.
