Public, protected, private, friendly

xiaoxiao2021-04-09  381

Public, protected, private, friendly

Public class, class variables, methods, packages, and any classes outside the package can be accessed; protected, class, class variables, methods, any classes in the package, and those subclasses outside of the package Can access; private class, class beam variables, and methods, any class outside the package cannot be accessed; if a class, class variables and methods do not modify these three modifiers, it is a friendly type, then package Any class within the package can access it, and any class outside the package cannot access it (including the subclass of such classes outside the package), so this kind of class, class, class variables, and methods are friendly in the package. Open, and other classes outside the package are closed.

转载请注明原文地址:https://www.9cbs.com/read-133195.html

New Post(0)