public class Lambda { public static void main(String[] args) { //未简化 S s = new S() { @Override public void s() { System.out.println("123"); } }; s.s(); //简化 S s1 = ()->{ System.out.println("Lambda简化"); }; s1.s(); } } interface S{ void s(); }
public class Lambda { public static void main(String[] args) { //未简化 S s = new S() { @Override public void s() { System.out.println("123"); } }; s.s(); //简化 S s1 = ()->{ System.out.println("Lambda简化"); }; s1.s(); } } interface S{ void s(); }