For top-level classes (external classes), there are only two modifiers: public and default. Because the previous unit of the outer class is a package, the outer class has only two scopes: the same package, anywhere. Therefore, only two control permissions are required: Package control and public access, and two control modifiers: publicly and default.
If the class uses the private modifier, the description is an inner class. The upper level of the inner class is an external class, so there are four access control modifiers: This class (private), the same package (default), the parent-child class (protected), and any location (public). When a private adornment is used by an inner class, it can only be used inside the outer class of the class.
These are all common use, but why is this happening?
Consider that a Java project cannot be done in a class. In the MVC pattern, the class is divided into three layers, and the class is called from layer to layer. It cannot be called if it is defined as private and protected. In other words, for a Java file, either run alone, or be called by another program as a library, if a Java file class is private, then it is not other programs or classes can not use it, then he as a separate file is useless. If it runs as a single file, the class loads how to find it, because it is not visible externally. At the same time, the existence meaning of the class is lost. Therefore, the class has only public and default modifiers.
Why can't the external class of Java be decorated with private, protected