Santhiya Park Java SE Training Summary (85-) (inner Class)

Source: Internet
Author: User
Tags java se

85-
The inner class is divided into 4 kinds

  1. Static Inner class
  • Inside a class, a class decorated by the static keyword is called a static inner class, and its inside can only access static members and methods of the outer class! After compiling, an external class $ inner class is generated. class file that instantiates an inner class object when an external class. Inner class inner= new external class. Inner Class ()
  1. member Inner class
  • defined in an external class, a class that has no static adornment, like a member method, can use all members of an external class. This class is owned by all objects, just like a member. Instantiate in an external class, use the this. Inner class (). Used when instantiating in other classes (new external Class ()). New inner Class (). When accessing external class members in an internal class, use OtterClass.this.member.
  1. A local inner class is defined in a method, just like a local variable, and can only be used within a method, and only the final variable is accessible in the class
  2. Anonymous inner class is a kind of local inner class, it has no name, no class keyword definition, no extends, implement keyword, no constructor method, implicitly inherits a class or implements an interface!

Santhiya Park Java SE Training Summary (85-) (inner Class)

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.