package lambda;
public class TestLambda {
public static void main(String[] args) {
//匿名内部类
ILike like1 = new ILike() {
@Override
public void lambda() {
System.out.println("你瞅啥瞅");
}
};
like1.lambda();
//lambda表达式
//简化了除了方法体外的所有重复部分,用()->代替
ILike like2 = ()->{
System.out.println("再瞅我抽你啊");
};
like2.lambda();
}
}
//定义一个函数式接口
interface ILike{
void lambda();
}
标签:void,ILike,System,理解,Lambda,public,表达式,lambda
From: https://www.cnblogs.com/qt0312/p/16833784.html