Given a simple interface with a standard method:
private interface A { default void hello() { System.out.println("A"); } }
And the method that takes its instance:
private static void print(A a) { a.hello(); }
I can override this with an anonymous class:
print(new A() { @Override public void hello() { System.out.println("OverHello"); } });
but if I try to use lambda print(() -> System.out.println("OverHello2")); I get a compilation error.
No target method found
Is there a way to do an override with lambda?
T4l0n source share