其他分享
首页 > 其他分享> > 继承

继承

作者:互联网

继承

package opp;

import opp.Dome05.Person;
import opp.Dome05.Student;

public class Application01 {
  public static void main(String[] args) {
      Person person = new Person();
      System.out.println(person);

  }
  }
package opp.Dome05;
//所有的类都会默认直接或者间接的继承Object
//人 父类
public class Person {

}
package opp.Dome05;
  //Student is person 派生类,子类
public class Student extends Person {

}
package opp.Dome05;
//teacher is person 派生类:子类
public class teacher extends Person {
}

标签:opp,继承,子类,Person,Dome05,父类,public
来源: https://www.cnblogs.com/java5745/p/15010363.html