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.
Inner class: 1. Inner class 2. Nameless Inner class
Internal class Application:
Example 1: Accessing static internal classes.
The external class name is included.
Example 2: Access to an instance's inner class to have an object to access.
After you have to produce the object, hold the object (.) point new B, or the instance inner class cannot be created.
Static inner classes can be applied: static methods, instance methods, static blocks, instance blocks.
You cannot access: instance members.
Instance inner classes can be applied: instance methods, instance blocks.
Can not apply: Static method, static block.
You can access: instance members.
Nameless Inner class:
The method inside the nameless inner class is not accessible to external variables, because the outside variable will change, fearing that the value of subsequent accesses is inaccurate and meaningless.
Constants in Java can, because constants are stored in a constant layer, why is it accessible under the graph? Because it automatically turns a variable with no duplicate assignment into a constant.
Nameless Inner class shorthand:
Enumeration: is a selector, in the future methods need to pass the selection, that is, with the enumeration, a glance can understand how to pass.
In the future we have access to other people's code, but when we call someone else's method, we find the int type, which is the time when we don't know what value to pass. But see the following method is an enumeration class, we know that it is a selector, just need to select a parameter in the enumeration to pass in it, and then in the enumeration to apply for some parameter types, through enumeration to the inside of the value. (To resolve ambiguous parameters)
Main method Parameter description: public static void Main (String [] args) {}
Used to receive external parameters.
Why is an array type?
Indicates that many startup parameters can be accepted.
Java basics-Object-oriented (inner class)