之前一直认为java中的子类会继承父类的私有属性以及方法,只是无法调用。之前看过的一些视频,还有很多大佬应该也是这么认为
但是下面来自oracle的官方文档:
inherited by subclasses of that class
声明为私有的类的成员不会被该类的子类继承
Constructors, static initializers, and instance initializers are not members and therefore are not inherited.
构造函数、静态初始化器和实例初始化器都不是成员,因此不能继承。