Bi Xiangdong Java Basics: day09_3-4

Source: Internet
Author: User

day09-03

1. Anonymous inner class usage scenarios.

body{//body including heart

Private class xinzhang{//Heart can be a member variable of body. If you don't want to be accessed by others, add private

}

Public Showxinzang () {//If the heart is diseased, you can expose your heart to the outside.

New Xinzang ()

}

}

day09-04

1, if an inner class is defined in a method, then anonymity becomes a local inner class and cannot be defined as a static member.

2. Internal classes Access local variables, you must define final

3. Anonymous inner class, inheriting abstract class or interface.

4. Exercise 1:

Test.function.show ();

Exercise 2:

Exercise 3:

Bi Xiangdong Java Basics: day09_3-4

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.