Because that’s a method reference, the usage is a bit different:
Consumer<String> c = System.out::println;
The argument that the consumer takes (s
) will be still passed to the println
method.
here is Oracle’s tutorial on this.
Because that’s a method reference, the usage is a bit different:
Consumer<String> c = System.out::println;
The argument that the consumer takes (s
) will be still passed to the println
method.
here is Oracle’s tutorial on this.