Method reference is a functional interface.it is use to replace lambda expression to call a method.Method reference to call a static method of a class – Class::staticMethod
interface Test {
public void getName(String name);
}
public class MethodReferenceTest {
public static void getInfo(String info) {
System.out.println("checking- " + info);
}
public static void main(String[] args) {
Test e = (String name) -> {
System.out.println("welcome:- " + name);
};
e.getName("ankit");
Test e1 = MethodReferenceTest::getInfo;
e1.getName("ankitky");
}
}