qq_青枣工作室_0
需要额外增加一个Interface接口才行。class Test
{
public static void main (String[] args)
{
Test t = new Test();
MyInner inner = t.getInner();
inner.innerTest();
}
public MyInner getInner() {
class Inner implements MyInner{
public void innerTest() {
System.out.println("innerTest");
}
}
return new Inner();
}
}
interface MyInner{
void innerTest();
}