Scope of the access modifier:
Private: You can define methods or properties that define methods and properties that cannot be accessed by external classes (including subclasses). Default: It can be accessed anywhere in the package. Protected: protection, non-subclasses in different packages cannot be accessed. (The members that can be accessed include the same package and any subclasses of the class) public: they are accessible and free of any restrictions.
Java Inheritance & access modifiers combined with the big mess 1. Does the subclass overloaded method have permission to be less than the parent class definition? Which, private<default<public not allowed,Note: The polymorphic representation of the parent Parent=new children () is allowed in Java, if the subclass method permission is allowed to be small at this timeinparent class, it is clear that the variable is declared as a child type and is allowed access when declared as parent, which is clearly illogical.
2.if the private method is declared in the parent class, is it overwrite to use the default permission in the subclass? is not overwrite and is now redefined.
3.overwrite of the parent class and the child class with the same name propertyReference Links:http://gaolixu.iteye.com/blog/363709
A. The same name variable access permission is the same:
The value of the variable depends on the type of the variable we define, not the type of the object being created (where the private modified variable is not considered), that is:
parent
parent=new Parent ();//The value
of the parent class Parent childofparent=new Child ();//The value of the parent class
child=new Children ();//The value of the subclass
B. The modification of the subclass access permission does not affect the final result.
Extended reading: Java's acquisition of class objects and the process analysis of instantiating objects in two ways
From for notes (Wiz)
Java access control and considerations arising from the combined inheritance system