Static member classes for Java

Source: Internet
Author: User

Static member classes for Java:


1, static member class is the simplest nested class. It is better to think of it as an ordinary class, just happen to be declared inside another class, and it can access the members of the perimeter class, including those declared as private.

2. A static member class is a member of a perimeter class that, like other static members, adheres to the same accessibility rules, and if it is declared private, it can only be accessed within the perimeter class.

3. If an instance of a nested class wants to exist independently of an instance of a perimeter class, the nested class must be a static member class: It is not possible to create a non-static instance of a member class without a perimeter instance.

4. A common use of static member classes is as a public auxiliary class.

Static member classes for Java

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.