public class Application {
public static void main(String[] args) {
student.say();
System.out.println(student.money);
Student student = new Student();
student.test("JH");
student.test1();}
}
====================================
// 学生 is 人 :派生类 子类
//子类继承父类,就会拥有父类的全部方法
public class Student extends Person{
public Student() {
//隐藏代码:调用了父类的无参构造
super();//调用父类的构造器必须要在子类第一行
System.out.println("Student无参执行了");
}
private String name = "jiahui";
public void print(){
System.out.println("student");
}
public void test1(){
print();
this.print();
super.print();
}
public void test (String name){
System.out.println(name);
System.out.println(this.name);
System.out.println(super.name);
}
}