1、接口註解(@FunctionalInterface)ide
@FunctionalInterface interface Interface1 { public void print(); } public class LambdaTest { public static void main(String[] args) { // Interface1 i = new Interface1() { // @Override // public void print() { // System.out.println("QAQ"); // } // }; Interface1 i = () -> System.out.println(" I am lambda Demo"); i.print(); } }
2、引用spa