public class InlineSingleImplementation { interface MyIface { void mySimpleMethod(); } static class MyIfaceImpl implements MyIface { @Override public void mySimpleMethod() { System.out.println("Impl"); } } void test(MyIface iface) { System.out.println("Impl"); } }