Java Lambda表达式
Lambda是函数式编程,就是为了不创建对象直接调用方法。
一个接口必须只有一个方法才能使用Lambda表达式。
不使用Lambda表达式时:
public static void main(String[] args){
print(new MyMath() {
public int sum(int x, int y) {
return x+y;
}
},100,200);
}
public static void print(MyMath m, int x, in
原创
2021-04-07 17:58:32 ·
101 阅读 ·
0 评论