Now I am learning Java and I have written a code like this:
public class LambdaClass {
public static void main(String args[]) {
Plane pl = () -> {
System.out.println("The plane is flying...");
};
pl.fly();
}
interface Plane {
void fly();
//void speedUp(); if I uncomment this, it is an error
}
}
and I am interested in what is the connection between the lambda expression and the Plane interface methods, I mean is lambda expression's body statements now assigned to fly method of pl instance and why is it so?