abstract class Two {
Two() {
System.out.println("Two()");
}
Two(String s) {
System.out.println("Two(String");
}
abstract int display();
}
class One {
public Two two(String s) {
return new Two() {
public int display() {
System.out.println("display()");
return 1;
}
};
}
}
class Ajay {
public static void main(String ...strings ){
One one=new One();
Two two=one.two("ajay");
System.out.println(two.display());
}
}
我们无法实例化抽象类,那么为什么函数 二二(String s)能够创建抽象类二的实例????