Here is an example I ran across while studying the functional interface concept.
interface Sayable{
void say();
}
public class MethodReference {
public static void saySomething(){
System.out.println("Hello, this is static method.");
}
public static void main(String[] args) {
// Referring static method
Sayable sayable = MethodReference::saySomething;
// Calling interface method
sayable.say();
}
}
This is printing "Hello, this is static method." in output when it runs. My question how it is printing the output when we call the say() method( which is not implemented)