1. Private Permissions
Private can modify data members, construct methods, method members, and cannot decorate classes (this refers to external classes, regardless of inner classes). Members that are decorated by private can only be used in the class in which they are defined and cannot be called in other classes.
2. Default Permissions
Classes, data members, constructor methods, method members, all have the ability to use the default permissions, that is, no keywords are written. The default permissions are the same as package permissions, and the elements of the same package permission are called only in the class in which they are defined, and in the same package class.
3. Protected rights (Protected)
Protected can modify data members, construct methods, method members, and cannot decorate classes (this refers to external classes, regardless of inner classes). Members that are modified by protected can be called in the class that defines them, in the same class as the package. If classes with different packages want to invoke them, then the class must be a subclass of the class that defines them.
4. Public rights
Public can decorate classes, data members, constructor methods, method members. Members that are modified by public can be called in any class, regardless of the same package or different packages, which is the most privileged modifier.
Four kinds of permissions in Java