简单范例
@FunctionalInterface //函数式接口interface IMessage{ public void send(String str);}public class Lamda { public static void main(String args []){ IMessage msg = (str)->{ System.out.println("发送消息"+ str); }; msg.send("我在这呢"); }}Lamdba表达式如果想要使用,那么必须有一个重要的实现要求:SAM(single Abstract method )只有一个抽象方法。