Re read the “Java programming ideas” series and other access rights
In Java, we use access modifiers to determine which classes in the library are available to users. Access modifiers include public, protected, private and write nothing. So for classes, we can only use public and write nothing. Protected and private cannot directly modify classes. We try it in the compiler. If both are found, an error will be prompted. This shows that it is not feasible.
Public modifier class
When we use public to modify classes, we should pay attention to the following two limitations. 1. There can only be one public class in the same class. Multiple classes are not allowed.
Modifier class without modifier
Unlike public, for example, your file is called testpublic. If you don't add modifiers to your internal classes, you can name them at will. This is absolutely not wrong, but it is generally not done.