Java OCA OCP Practice Question 1611

Question

Rewrite this lambda using a method reference:

() -> Math.random()
  • A. Math.random
  • B. Math::random
  • C. Math::random()
  • D. None of the above


B.

Note

This is a static method reference.

It uses :: to separate the class name and method name.

Option B is correct.




PreviousNext

Related