- Abstract Abstraction
- method
- Abstract method: The method of an abstract modification, which is only declared without the implementation of the method (not even {}).
- syntax: modifier Returns a value type method name (formal parameter list);
- Note: Abstract methods must be defined in an abstract class.
- class
- abstract class: by AB Stract decorated class, cannot instantiate (create object).
- syntax: modifier class class name [Inheritance relationship]{}
- Note:
- abstract class does not create objects; but can declare references (forced polymorphism).
-
- Abstract classes can have abstract methods or non-abstract methods.
The benefit of the abstract class: forcing polymorphism.
- static statics,
- Attribute/instance Variable
- Syntax: Within the class, the static data type variable name outside the method;
- Concept: A class variable/static variable, which is a static modified property/instance variable that is shared by all objects of that class (object-independent).
- Use: Class name. property name
- Method/instance method
- syntax: access modifier static return value type method name ( Formal parameter list {
//method implementation part
}
- Concept: Class method/static method, refers to the static modified method, is shared by all objects of the class (Object-independent).
- use: Class name. Method name (argument);//Suggestion
- Note: This and super are not allowed in
-
- The method of span style= "font-size:12pt" >static modification can be inherited, but only by static method, but not polymorphic (see below);
-
-
- static code block
- initial code block: a block of code defined outside of a class, as a method. The
-
-
- final final
- variable (instance variable + local variable +static variable)
The
- final modified variable is the final variable and can only be assigned 1 times without modification (constant).
- Note: The
- final decorated instance variable will no longer be assigned a default value;
- can assign initial values in the Declaration/initialization code block/constructor method;
- If you use the constructor method To assign the initial value to the final attribute, it is necessary to ensure that the initial value is assigned to all constructs. The
- final decorated class variable will no longer be assigned a default value, and the initial values can be assigned to the declaration/static code block. When
- final modifies a variable of a reference type, the value representing the reference itself is not allowed to be modified (the address value is not allowed to change).
 
- method The
- final decoration method is the final method and cannot be overridden. The
- class
- final decorated class is the final class and cannot be inherited.
- If a class is final, all methods in the class are final.
- Expansion and Promotion:
- Static,final and abstract are not able to modify the construction method
- Class loading
- Concept: When the JVM uses a class for the 1th time, it first finds the corresponding. class file from the Classpath, reads all the contents of the file (Properties/Methods/class name/package structure/construction/static ...), and saves the process, called class loading.
- Class loading is performed only 1 times in the same JVM.
- Class load time: 1th time a class is used
- Create objects of this class
- Use static members of this class (static variable/static method)
- Create child class objects or use static members of subclasses
- Recursively loads the parent class Class 1 times
- Subclass classes Loaded 1 times
- Allocate space All instance variables assign default values
- Recursive creation of parent class objects
- Initializes this class of properties and initial code blocks to execute as defined
- Call this class constructor method
Java Essentials Note (7)----three modifiers