Java Basics-Internal classes

Source: Internet
Author: User

Statement: The material used in this column is written by the VIP students of the Kay Academy, who has the right to be anonymous and has the final right to interpret the article; The Edith Academy is designed to promote students to learn from each other on the basis of public notes.

Modular BLOCK: Also known as component development, compression package is a class, and later we write project writing projects, there may be some common code, no matter what you write the project, it is the same code, it is to put these repetitive functions into a jar package, packaging, and later who will use the past to use the line, It's like a car is made up of a lot of parts, you can make these parts more general, and then those cars need to go directly to the past.
Www.apache.org This is a nonprofit organization with some JAR packages

Enumeration:
is a new feature of jdk1.5, it is to solve such a problem, such as: give a number to return a content, such as you do not know what the number of times, apply a few constants, in the future you want to invoke the choice on the line, is a selector, this is the enumeration and come out of the time of the wording

The enumeration can be used to tell you the type of this method, take the enumeration type to choose a line, is actually a class, inside the application of some constant enumeration inside can have constructors and methods, but not necessary, because its main function is to provide a choice

Inner class:
Introduction: Is the class in the application of a class, there are internal interfaces, internal abstract class, internal enumeration, the general inner class is not to let outsiders use, so the establishment of inner class inner classes are divided into static and instance:
Static creation of new Test.t1 ();
Instance to create an instance object. New T1 ();

Static Inner class
can have instance members
can have static members

Instance inner class: can have instance members
Can not have static members

Regardless of how the class is written, a separate class file will be created after compilation

Nameless Inner class:
There is no name on the class, the nameless inner class can only generate access to constants. Like this, you write a code on a file that says a class feels wasted or troublesome.

So there's a nameless inner class, write a curly brace that says the Nameless class has implemented the interface

Java Basics-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.