Java Internal classes

Source: Internet
Author: User

A class is defined in the interior of an outer class. The class name does not need to be the same as the folder.

* Inner classes can be static, or public,default,protected and private adornments are available. (The external top-level class, which is the same as the class name and the file name, can only use public and default).

1. Non-static inner classes: perimeter classes and inner classes can access their own private members. static member variables cannot be defined in an inner class . 2. Static inner class: only static members of external classes can be accessed.       3, local inner class: The inner class does not have any access control permissions The outer class is invisible to the local inner class of the method, but the local inner class can access any member of the perimeter class.       The local inner class can be accessed in the method body, but the access statement must be after the local inner class is defined. A local inner class can only access constants in the method body, that is, members that are decorated with a final decoration. 4. Anonymous inner class: There is no constructor, instead, the constructor parameter is passed to the Super class constructor.

Java Internal classes

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.