Default access control for Java members
For a class member variable or member function, if you do not use any modifier in public, protected, or private, the member will be assigned the "default access control" level, that is, package access ).
A package access member can be accessed by other classes in the same package, but cannot be accessed by classes in other packages.
Package access control is weaker than private, but stronger than protected. On the one hand, as long as it is a subclass, no matter whether the subclass and the parent class are in the same package or not, the subclass can access the protected method in the parent class. However, once it is outside the package of the original class, no matter whether it is its subclass or not, it cannot access its members at the package access level. On the other hand, a class can access the package access members of another class in the same package and also its protected members.
(Note: package is a keyword in Java. Although package access is also an access control level, the keyword "package" can only be used to indicate which package the class belongs to, rather than "private ", put it in front of the member variable or function as the access control modifier .)
Access-level protection strength: Public <protected <default <private