There are only three access modifiers public,protected and private in Java.
1, if you do not write any modifiers, the default is "package access permissions." The equivalent of all other classes and methods within the package is public, and the classes and methods outside the package are private. Because the grace of a compilation unit (a Java file) is attached to a package, all classes that are in the same compilation unit are automatically accessible to each other through package access. (This is why a package exists)
2. Inherited classes can access both public members and protected members.
3, access rights to obtain the means:
1. Make the access to this member public.
2. By modifying the word without access and placing other classes in the same package, access is based on other member packages.
3. Inherit a class
4. Provide a Get (), set () method. One, public is available to all members, especially the client programmer who uses the class library, and second, private except for the class to which the private-decorated member is located, no other class can access the member. The default access permission is a common privilege. It's also a few days away. Any permission control is automatically available, so you may not think that you will often need to use the keyword private, because without him to work, however, private permissions are very important, especially in a multithreaded environment. third, protected protected deal with the concept of inheritance. If you create a new package and inherit the class from another package, the only member that can be accessed is the public member in the source package. Protected also provides package access, meaning that other classes in the same package that are not inherited from him can access protected-decorated methods or properties. Four, very important point 1, for class access, only two choices, package access rights and public. Neither can it be private nor can it be protected. (internal classes can have private and protected)