← Quiz: Lambdas and Functional Interfaces: all 10 questions
Quiz: Lambdas and Functional Interfaces · Question 5 of 10
Which method reference is the same as s - s.trim()?
Which method reference is the same as s -> s.trim()?
- A.s::trim
- B.String::trim
- C.trim::String
- D.String.trim()
Answer & explanation
Correct answer: String::trim
A method of "any object of a type": the lambda's parameter becomes the object the method is called on.
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 →