class Test
{
public static Inter function()
{
Inter in = new Inter()
{
public void method()
{
System.out.println("haha");
}
};
return in; 给你把代码改一下就清楚了,只是省略了 Inner s = new Inner() 直接把等号后面的全部返回了,不就是一个对象了吗?
}
}
public static void main(String[] args)
{
Test.function().method();
}