一、Object类
package com.oop.demo05; //在Java中,所有的类都默认直接或间接继承Object类 //父类 public class Person { public void say(){ System.out.println("说了一句话"); } }
package com.oop.demo05; //学生 is 人,派生类,子类 //子类继承了父类,就会拥有父类的全部方法! public class Student extends Person { //Ctrl + H }
package com.oop.demo05; //Teacher类是派生类,是子类 public class Teacher extends Person{ }
标签:Person,继承,子类,09,class,面向对象,oop,父类,public From: https://www.cnblogs.com/sankouyitouju/p/18096029