In Java, where subclasses inherit the parent class and want to overwrite a field in the parent class, you can declare a property in the subclass that is exactly the same as the property name and type in the parent class, and calling these properties in the subclass is the attribute that is defined in the calling subclass, not the attribute from the parent class. The value of the property with the same name in the parent class is not affected by the same name attribute in the child class, that is, the attribute in the subclass cannot overwrite the property in the parent class, and if you want to modify the property in the parent class, only through the set method or directly to the attribute amplitude in the parent class, without the case that the subclass overrides the
This article is from the "Flying Fish Technology" blog, please be sure to keep this source http://flyingfish.blog.51cto.com/9580339/1722337
Java Class Attribute inheritance relationships