interface Inter
{
public abstract Inter show();
//public abstract Inter show2();
}
class Outer
{
public void method()
{
new Inter()
{
public Inter show()
{
System.out.println("show");
return this;
}
public Inter show2()
{
System.out.println("show2");
return this;
}
}.show().show2();//先执行show()和先执行show2()所返回的对象不一样吗?
}
}
class AnonymousTest
{
public static void main(String[] args)
{
new Outer().method();
}
} |