How come... part 1: importing statically

Timo Kinnunen timo.kinnunen at
Sat Jan 4 03:42:07 PST 2014

I was porting some C++ code which calls a printf function and got to thinking. How come I can write:

Arrays.asList("--(!)Error loading\n").stream().forEach(System.out::printf);

but I can’t write:

import static java.lang.System.out::printf;

. . .

printf("--(!)Error loading\n"); 

What’s up with that? 

(This is part 1 in my How come... series, more parts as they come.)


Have a nice day,


Sent from Windows Mail

More information about the lambda-dev mailing list