继承:
作用:
提高了代码的复用性。
让类与类之间产生了关系,为多态提供了前提
继承中成员变量的特点:
继承中成员函数的特点:
方法重写:
注意:重写方法必须和被重写的方法具有相同的方法名,参数列表和返回值类型
覆盖时,子类的方法权限一定要大于等于父类的方法权限
静态只能覆盖静态
父类的私有方法不可以被覆盖
this()与super():
this()相当于调用本类的构造函数,super()相当于调用父类的构造函数,super与this只能存在一个。