Files
javaSE-0419/day09/src/com/inmind/extends_constructor04/Demo05.java

18 lines
514 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.inmind.extends_constructor04;
/*
继承中构造方法的访问特点
1.创建子类对象时,一定会调用父类的构造方法
2.super调用父类的构造方法时必须在子类的构造方法的第一行
3.super可以调用父类的有参构造方法。
*/
public class Demo05 {
public static void main(String[] args) {
//创建子类对象
Zi zi = new Zi();
//创建父类对象
Fu fu = new Fu(10);
System.out.println("程序结束");
}
}