标签:
奇葩的语法,一个匿名类继承A,重载了say方法
public class TestClass
{
public static void main(String[] args)
{
A a = new A();
A aa = a.getA();
aa.say();
a.say();
System.out.println(aa instanceof A);
}
}
class A
{
public A getA()
{
return new A()
{
public void say()
{
System.out.println("AAAAAAAAA");
}
};
}
public void say()
{
}
}
标签:
原文地址:http://www.cnblogs.com/shuiyonglewodezzzzz/p/5104934.html