代码
提交代码
import java.util.function.Consumer; public class MethodReferencesDemo1 { public static void main(String[] args) { Consumer<String> consumer = s -> System.out.println(s); consumer.accept("只消费,不返回"); } }
运行结果