继承

class Parent {
public Parent() {
System.out.println("调用父类构造方法");
}
}
class Child extends Parent {
public Child() {
System.out.println("调用子类构造方法");
}
}
public class Demo {
public static void main(String[] args) {
new Child();
}
}

posted @ 2021-10-05 22:17  年年ℓ  阅读(13)  评论(0)    收藏  举报