DESKTOP-ESBC3OR_20200829-蒋生桃
问题
public class Base {
public Base( String s ) {
System.out.println( "B" );
}
}
public class Derived extends Base {
public Derived(String s) {
System.out.println( "D" );
}
public static void main(String[] args) {
new Derived( "C" );
}
}
考试的时候死活没往调用父类构造哪儿想,想当然地认为问题出在了main方法中,觉得 new Derived( "C" );是错的
解决
把代码一运行,问题就解决了
吐槽
又又又又一周的考试,我终于及格了?
点赞