Java 8 Method Reference to non-static method
Why this doesn't work? I get compiler error "Cannot make static reference to the non static method print..." public class Chapter3 { public void print(String s) { System.out.println(s); } public static void main(String[] args) { Arrays.asList("a", "b", "c").forEach(Chapter3::print); } } Regardless of whether you use method references, lambda expressions or ordinary method calls, an instance method requires an appropriate instance for the invocation. The instance may be supplied by the function invocation, e.g. if forEach expected a BiConsumer<Chapter3,String> it worked. But since forEach