2
class X
{
void method1(){}
void method2(){}
}
class Y
{
void someMethod()
{
/*
What is this type below called?
Anonymous class or
Anonymous-Inherited class or what???
*/
X xInstance = new X(){
@Override
void method1()
{
System.out.println("What kinda class is this ?");
}
}
}
}
你是说它没有继承任何类X? 。我看到我可以访问超级(是否正确?)。与对象层次结构有关的实际发生了什么?它是如何工作的 ?它看起来像X类的匿名孩子。我说得对吗? – panzerschreck 2011-02-02 06:37:13