We would like to know how to pass in IntConsumer.
/*from ww w .j a v a2s .c om*/ import java.util.function.IntConsumer; public class Main { public static void main(String[] args) { // no need to { } start(e -> System.out.print("Release year: " + e), 2013); } public static void start(IntConsumer cons, int d) { cons.accept(d); } }
The code above generates the following result.