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

Which method reference can replace the lambda on the second line so the output is the same? 

var s = "fish"; Predicate pred System.out.println(pred.test("is")); = (a) > s. contains

A. s::contains(a)

B. s::contains

C. String::contains(a)

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("is")); = (a) > s. contains (a);

Step by Step Solution

3.43 Rating (150 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The lambda expression provided here is a scontainsa which is a lambda expression that matches the Pr... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Oracle Questions!