004.函数式接口
1.JDK8常用函数式接口
2.示例代码
package com.imooc.lambda; import java.util.function.Consumer; /** * ConsumerSample接口的使用 */ public class ConsumerSample { public static void main(String[] args) { output(s -> System.out.println("Put:" + s)); } public static void output(Consumer<String> consumer) { String text = "123"; consumer.accept(text); } }