🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Java 8 Lambdas and Streams: all 10 questions

Quiz: Java 8 Lambdas and Streams · Question 5 of 10

Which is the method reference for s - s.length()?

Which is the method reference for s -> s.length()?

  1. A.s::length
  2. B.String::length
  3. C.length::String
  4. D.String.length()
Answer & explanation

Correct answer: String::length

Class::method refers to the instance method called on each element.

Can you get the rest right without peeking?

Take the timed Quiz: Java 8 Lambdas and Streams quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →