关于匿名内部类实现构造器的疑问
[code=Java][/code]abstract class Base {
public Base(int i) {
System.out.println("Base constructor, i = " + i);
}
public abstract void f();
}
public class AnonymousConstructor {
public static Base getBase(int i) {
return new Base(i) {
{
System.out.println("Inside instance initializer");
}
public void f() {
System.out.println("In anonymous f()");
}
};
}
public static void main(String[] args) {
Base base = getBase(47);//是通过此句调用基类构造器吗?
base.f();//base所指向的是不是那个匿名内部类?
}
} ///:~
------解决方案--------------------看这个帖子:
http://topic.csdn.net/u/20080728/20/d60f719a-c103-44b8-8d0c-bc1c818b768a.html
------解决方案--------------------顶起。。。学习。。。