class A{
A(int i){
}
}
class B extends A{
}
A、Compile-time error at 5.
B、Compile-time error at 1.
C、The compiler attempts to create a default constructor for class B.
D、The compiler attempts to create a default constructor for class A.能说说为什么么?
A(int i){
}
}
class B extends A{
}
A、Compile-time error at 5.
B、Compile-time error at 1.
C、The compiler attempts to create a default constructor for class B.
D、The compiler attempts to create a default constructor for class A.能说说为什么么?
C不对吧 B extends A{ } 这已经报错了。 如果是“attempts to create”即试图创建也肯定先创建父类对象,怎么说都不能能直接创建B。
C不对吧 B extends A{ } 这已经报错了。 如果是“attempts to create”即试图创建也肯定先创建父类对象,怎么说都不能能直接创建B。这个default constructor我理解有误了,我以为是编译器自动改错提供的构造函数。答案应该是A