in the Java language, classes, packages, and access modifiers together build a Java access control mechanism.
There are two types of access permissions for a class: the public modifier and the no public decoration. Class is declared public, the class can be accessed by the code of any package; This class can be accessed by code in this package when the public adornment (default) is not used.
Note: the modifiers for the inner class are public, no modifiers, protected, and private. The meaning is the same as the modifiers of the member access rights in the class.
the access rights of members in a class, from small to large, by the size of the access rights:
Private Member: the code that is in this class can access it, and the properties and methods that are decorated with it can only be accessed by objects of that class, whose subclasses cannot be accessed or allowed to be accessed across packages.
default (no modifier) member: code in the same package can access it.
Protection (Protected) Members: properties and methods that are decorated by them can only be accessed by methods and subclasses of the class itself, even if subclasses are accessible in different packages.
Public Members: properties and methods that are decorated by them can be accessed not only across classes, but also across packages.