🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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()?

  1. A.s::trim
  2. B.String::trim
  3. C.trim::String
  4. 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 →