Deep understanding of Java inner classes and anonymous inner classes

Source: Internet
Author: User

1. What if someone asks you if the interface in Java can be new? I think the answer should be yes, when implementing an anonymous inner class.

http://blog.csdn.net/cntanghai/article/details/6094481



2. If someone asks you if the class can be modified by private, I think the answer is yes, one of the benefits of the inner class.

1. internal classes can be very good to implement the hidden

The generic non-intrinsic class is not allowed to have private and protected permissions, but the inner class can

2. Inner class has access to all elements of the perimeter class

3. However, multiple inheritance is achieved

4. you can avoid modifying the interface and implementing the invocation of two methods of the same name in the same class.

http://andy136566.iteye.com/blog/1061951

Deep understanding of Java inner classes and anonymous inner 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.