Java8 函数式接口深入探究
函数接口的定义:有且仅有一个抽象方法的被成为函数接口是比较叫片面的,下面一起看接口定义: @FunctionalInterface public interface MyInterface { void test(); String toString(); } 上面接口定义接口也是函数接口,这是为什么呢? 答案揭晓:因为所有的函数接口实现类都是继承Object类,所以自然拥有了toString 方法 public static void main(String[] args) { MyInterface myInterface = ()->{ }; Syst
下载地址
用户评论