permission size for four rights modifiers (public, protected, default, private)
Note: Default, does not have this keyword, it thinks that defaults, that is, nothing added!Generally, the default visibility is package visibility (package visibility).
Internal
Declared Class, Class Member, interface or interface member has internal visibility.
The internal modifier makes the class, interface, or member visible only in the current package. Code outside the current package cannot access
ModifierModifiers are keywords that apply to types or members . Modifiers can specify the visibility of a method , such as public or private, and you can specify the nature of an item , such as a vritual or abstract that has just been sent.
Four types of access modifiers in Java: Public, Protected, default (no modifiers, defaults), private.
Four modifiers that can be modified (class, method, member variable)
Public
Protected
Default
This is a creation in
Article, where the information may have evolved or changed.
The go language does not have public, protected, private, and other access control modifiers like other languages, which control visibility by letter capitalization,
This is a creation in
Article, where the information may have evolved or changed.
The go language does not have public, protected, private, and other access control modifiers like other languages, which control visibility by letter
Tag: code specifies default visibility. SH Engineer Strong Object StatOne, Java access modifierAccess modifiers to control the visibility of members in a classThere are four access modifiers, respectively: default,private,public,protected1, default:
Access modifier and visibility
In reality, everyone has their own secrets. Java is an object-oriented programming language, and its main function is to describe existing things and phenomena in reality, java provides access modifiers to share
In the study of the visibility of volatile semantics and the test of restraining order reordering, it is found that the feature of forbidden command reordering is not shown.The experiment code is as follows
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.