Access rights in Java
•
Java
There are four access permissions in Java, from large to small: public – > protected – > Default (friendly) – > private.
For a brief description:
Public scope is global;
The protected scope is within the class, under the same package and subclass;
Default or friendly, the scope is within the class and under the same package;
The private scope is only internal to the class.
See also the following figure:
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码