Hiding the implementation scheme of [Thinking in Java]

Source: Internet
Author: User

Hiding thinking in Java 1.3 implementation solution 【]:

Public: [public] means that subsequent definitions can be used by anyone.

PRIVATE: [private] means that no one except yourself, the creator of the type, and the member of the internal function of that type can access subsequent definition information.

Friendly: [friendly] involves the concept of "packaging" or "package"-that is, the method Java uses to build a library. Something is "friendly", meaning it can only be used within the packaging range (so this access level is also

It is called "package access ").

Protected: [protected] is similar to "private". It is only an inherited class that can access protected members, but cannot access private members.

Summary:

Public: All packages are accessible.

PRIVATE: in this class.

Friendly: default value. It can only be accessed in the middle of the package.

Protected: The subclass can be accessed.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.