0 votes
in Java by
What is a method reference ?

1 Answer

0 votes
by (5k points)
Java 8 method reference:- Method reference help us to point to methods by their names. A method reference is described by using :: (double colon) symbol.

A method reference can be used to point following types of methods:−

1. Static methods
2. Instance methods
3. Constructors using new operator (TreeSet::new)

Java 8 method reference is the shorthand syntax for a lambda expression that executes just ONE method. See the following syntax:-

Object :: methodName

Share:- Whatsapp Facebook Facebook

Welcome to Developerhelpway Q&A, where you can ask questions and receive answers from other members of the community.