Detailed explanation of Public,protected,default and private permissions issuesLet people better understand the Public,protected,default and private permissions issues between them, I will make an intuitive table. Through the step-by-step
Access modifier permissions from high to low are public, protected, default, Private.First, according to "whether is the same package", "whether is sub-category" divided into 4 cases + 5 cases of this type Second, the sub-class in the same
When using Java, often encounter four kinds of modifiers, namely public,protected, default (no modifier), private, here write down their differences public: In-Package outside the package accessProtected: In-package access, out-of-package only
For Java programmers, Java access rights modifiers public, protected, default, private and the difference between the use is certainly not a problem, here is no longer verbose, anyway, niang a search on a lot of. Recently, when finishing the
Why cannot private and protected be used for classes and interfaces? Private, protected, default, and privateprotected cannot be used for interface methods.
For java programmers, the differences and usage of the access permission modifiers public,
[Thinking in Java] modifier public, protected, default, private, thinkingprotected
When using Java, four modifiers, public, protected, default (no modifier), and private, are often encountered. The differences between them are written here.
Public:
There are four access modifiers in Java: public,protected,default,privateNote: This is about access to the properties and methods in the class, not the access rights of the class1.default: Package access rightsIf nothing is written, default defaults.
1.public protected Default Private groupPublic permissions are the largest, homogeneous, same package, different packages, with the Bun class between the parent class, different buns class can be accessed between the parent class.Java defaults to
(1) for the public modifier, it has the most access rights and can access any class, interface, exception, etc. under Classpath. It is often used for external situations, i.e. the form of an interface to an object or class outside.(2) for the
Access decoration into similar bun class otherPrivate True false falseDefault (friendly) True false falseProtected true True True FalsePublic true to True true TrueOverload: Method name is the same, parameter list (parameter data type, number, etc.)
PublicPublic, plus the properties and methods of this modification, can be accessed anywhere else in the program .PrivatePrivate, as opposed to public, with this modified property and method, is only allowed in this class to access
1, public:public indicates that the data member, the member function is open to all users, all users can directly make the call2, private:private means private, private means that except class himself, no one can directly use, private property
The meaning of the access modifier in Java, public, private, PROTECTE, default, is explained:Public (interface Access): The most restrictive modifier in the Java language, commonly referred to as "common". The classes, properties, and methods that
PublicHas the maximum access rights. all classes are accessible. Protectedis primarily used to protect subclasses. itself, subclasses, and classes in the same package can accessDefaultWithout modifiers. Sometimes referred to as friendly, it is
The root directory of the Web page would have been: 6 root/app/www/default; 1[[Email protected]default]# cat/app/server/nginx/conf/vhosts/default. conf2 server {3Listen the;4 server_name espressos.cn;5 index index.php index.htm index.html;6root/app/
Java Study Notes 21 --- supplementary description of internal classes of members (2) (corrected), Study Notes 21 ---
Fixed: the original article was a bit incorrect, mainly concerning the subclass of the member's internal classes.
Due to my
Security context: Whether the user's uid/gid is in the owner/owner group of the file;User (UID)/group (GID): identifierProcesses and files corresponding to user/group;User Group Category:Private group: A group that has the same name as the user name
FIX: The original article was a bit of a mistake, mainly about the subclass of the member's inner class.Because of my cognitive limitations, it is assumed that the subclass of the inner class should also be an inner class, but in fact, the knowledge
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.