1.概述:是函数式编程思想的体现,主要注重干什么.
2.格式:
package com.ithema;
public class Test01 {
public static void main(String[] args) {
//匿名内部类
swiming(new Swming() {
@Override
public void play() {
System.out.println("游泳");
}
});
//Lambda表达式
swiming(() ->{
System.out.println("去吧");
});
}
//参数为接口的方法
public static void swiming(Swming swming){
swming.play();
}
}
//接口类
interface Swming{
public void play();
}