Question: Which method reference can replace the lambda on the second line so the output is the same? A. a::contains(b) B. a::contains C. String::contains(b) D. String::contains
Which method reference can replace the lambda on the second line so the output is the same?

A. a::contains(b)
B. a::contains
C. String::contains(b)
D. String::contains
E. The supplied code does not compile.
F. None of the above.
var s = "fish"; Predicate pred System.out.println(pred.test("fish", "is")); = (a) ->s.contains (a);
Step by Step Solution
3.31 Rating (160 Votes )
There are 3 Steps involved in it
The code snippet provided declares a lambda expression that checks if the string s contains some oth... View full answer
Get step-by-step solutions from verified subject matter experts
