Internal class,

Source: Internet
Author: User

Internal class,

In a class, apart from defining normal variables and methods, a class is defined in the class, and the class in that class is an internal class.

 

The internal class can be modified in private or static mode when it is in the member position of the external class.

When the internal class defines static members, the internal class must be static.

When the static method of the external class accesses the internal class, the internal class must also be static.

 

Internal access rules:

Internal classes can directly access the variables and methods of their external classes. Because the internal class holds an external class reference-> external class name. this. Variable (method ).

To access internal classes, an internal class object must be created.

When something is described, there is something inside the thing, the internal thing is described with the internal class, because the internal thing is using the content of the external thing.

An automobile is a whole. The automobile contains components such as engines and tires. These components are also an object. Other components of the automobile can be used to run together, so the components can be expressed as internal components.

Related Article

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.