day09-继承中构造方法的访问特点

This commit is contained in:
2026-07-25 14:11:24 +08:00
parent 7d5c4ac590
commit 5a0ccb04c7
6 changed files with 88 additions and 0 deletions
@@ -0,0 +1,14 @@
package com.inmind.extends_constructor05;
/*
继承中构造方法的访问特点
1.创建子类对象时,一定会调用父类的构造方法
2.super调用父类的构造方法时,必须在子类的构造方法的第一行
3.super可以调用父类的有参构造方法。
*/
public class Demo05 {
public static void main(String[] args) {
Fu fu = new Fu();
System.out.println("--------------");
Zi zi = new Zi();
}
}