interface MyFunctionalInterface { void invokeMethodReference(int a); } class MethodSupplier { void m(int a) { System.out.println(a); } } class MethodInvoker extends MethodSupplier { public void doInvoke() { MyFunctionalInterface instance = null; instance = super::m; instance.invokeMethodReference(1); } public static void invoke() { new MethodInvoker().doInvoke(); } public void doInvoke2() { m(1); } public static void invoke2() { new MethodInvoker().doInvoke2(); } } public class Test2 { public static void main(String argv[]) throws Throwable { try { Class.forName("MethodInvoker").getMethod("invoke").invoke(null); } catch (Throwable x) { x.printStackTrace(System.err); } System.err.println(); try { Class.forName("MethodInvoker").getMethod("invoke2").invoke(null); } catch (Throwable x) { x.printStackTrace(System.err); } System.err.println(); try { MethodInvoker.invoke(); } catch (Throwable x) { x.printStackTrace(System.err); } System.err.println(); try { MethodInvoker.invoke2(); } catch (Throwable x) { x.printStackTrace(System.err); } } }