---restore content starts---
Four characteristics of object-oriented: Abstract inheritance encapsulation polymorphism
One: Class in Object-oriented
1: Function code multiplexing for classes
2: The composition of the class---code snippet: A full curly brace is a piece of code that represents a separate memory space
---Dynamic code snippet: A pair of curly braces without any adornments
---Static code snippet: A pair of curly braces static{} with static decoration, which is a snippet of code that runs during the load phase
---member variable: the size of heap memory is dynamically allocated in heap memory. Its invocation object name. Member variable name member variable belongs to association relationship---the value of a member variable is an application of another class object
---Static variables: are at the class level, and the values in each object are the same, and the static data area that is saved in memory it calls: Class name. Static variable Name
---Local variables: A variable declared in a method is a local variable, and when declared, it must be assigned to a local variable that is a dependency---the value of a local variable is an application of another class object
---constants: declaration: Public static final Data type Uppercase _ = value; The value does not change throughout the software life cycle
---Member Method: A method that does not have a static adornment is called a member method of its invocation: through the object name. Member Method Name
---static method: Called by the Static Modified method: Class name. static method name----saved in a static code area
---Construction method: Used to create a method of the current class object in the class instantiation (instantiating the current class object); The default is: public, static, no return value, the name and class name of the same
---This object: 1 prefix the member variable and assign the value
2 in the constructor method, the overload calls the other constructor methods in this class, which must be written in the first row of the constructor method when the this () overload is called
3 is used to represent the object of this class, which holds the address of this class, which is located in the first memory slice in heap memory
4 in heap memory, we have the memory address of the first memory slice in the heap memory as the memory address of the entire object, and named this
---Super object: Super Represents the parent type feature in the current subclass object.
The first row must be unloaded when the constructor method overload of the subclass calls the constructor of the parent class
Super () and this () cannot recur
Super can be used to invoke the parent class's member properties and member methods
3: Class Form---System Class, Class library class, General class and inner class
The inner class is divided into 4 types: static inner class
member Inner class
Local inner class
Anonymous inner class
4: Class Inheritance---A class can only inherit from one class, and only member variables and member methods can be inherited (local variables inside the method, regardless of being inherited)
---Implements can be implemented from multiple interfaces
The override of a method in a---inheritance must be between two classes that have an inheritance relationship Override:1
2 method Name, return value type, parameter list must be the same
3 The overridden method cannot have lower access rights than the original method
4 The overridden class cannot have a broader exception than the parent class
5 Private methods cannot be overridden, even if overwritten, to access the parent class's
6 Construction methods cannot be overridden
7 static methods cannot be overridden
8 Overwrite is specifically the override of member methods, and member variables, static variables and static methods are independent
5:6 Relationships between classes and objects---inheritance, implementation, dependency (local variables are references to another class object), associations (member variables are references to another class object), aggregations (the elements in a collection in a class are references to another class object), combined
6:final---Final-modified classes cannot be inherited
The final modified method cannot be overridden
The final modified local variable cannot be assigned two times
Final-Modified member variables must be immediately assigned
The final modified static variable, which is the constant
6: Special class: Abstract class
Interface---are all abstract methods of the class is the interface, the interface has no variables only constants
Constant---Uppercase public static final AAA; Features: The lifecycle of the software does not change
Two: 4 steps of instantiation of object new Object---1 call construction method, 2 open space; 3 copy; 4 Assignment
Third: Abstract classes are abstract classes that are decorated with abstractions
Abstract classes do not necessarily have abstract methods, but abstract methods must be declared in abstract classes
Methods that have no method body are called abstract methods, that is, methods that do not have curly braces, and need to be modified with an abstract
A non-abstract class knot inherits an abstract class, and all of the abstract methods must be implemented
Neither abstract class nor abstract method can be final, because it is used to inherit the implementation, final cannot be inherited and overwrite, conflict
IV: Declaration of Interface Interface---[modifier list] Interface interface name {}
Interface Content 1 constant, PSF, but the interface is a constant by default, so the PSF can be omitted
2 All methods are abstract methods, so abstract can be omitted
There is no construction method in the 3 interface, the interface cannot be instantiated
4 interface can be multiple inheritance, extends
51 classes can inherit only one class, but multiple interfaces may be implemented
61 non-abstract classes, implementing an interface must all implement the method in the interface
Five: polymorphic polymorphism occurs at the time of assignment
Inheritance and implementation---extend,implements
To move up---the parent class refers to the child class object---the memory address of the object of the class is assigned to the reference variable of the parent class object
rewrite [email protected]
Downward transformation---must be existing upward transformation, then the downward transformation
Polymorphic 4 Forms---member method polymorphism: In the formal parameter list of the method declaration is the parent class, when the invocation of the value is a subclass of the object reference
---constructor method polymorphism: When a method declaration is constructed, it is the object reference of the child class when the parent class passes the value
---the direct instantiation of polymorphism: The time of declaration is the parent class, when instantiated is a reference to a subclass object.
---member variable polymorphism: The member variable is declared as the parent class, but when assigned, it is the object reference of the child class
VI: Object---toString () a literal description of each object to itself, default is the memory address of the output object
---hashcode () returns the memory address of the object
---equals () compares memory addresses of reference data types by default and needs to be rewritten as you want
The method that is called when the---finalize () system cleans up garbage for an object
---restore content ends---
Four characteristics of object-oriented: Abstract inheritance encapsulation polymorphism
One: Class in Object-oriented
1: Function code multiplexing for classes
2: The composition of the class---code snippet: A full curly brace is a piece of code that represents a separate memory space
---Dynamic code snippet: A pair of curly braces without any adornments
---Static code snippet: A pair of curly braces static{} with static decoration, which is a snippet of code that runs during the load phase
---member variable: the size of heap memory is dynamically allocated in heap memory. Its invocation object name. Member variable name member variable belongs to association relationship---the value of a member variable is an application of another class object
---Static variables: are at the class level, and the values in each object are the same, and the static data area that is saved in memory it calls: Class name. Static variable Name
---Local variables: A variable declared in a method is a local variable, and when declared, it must be assigned to a local variable that is a dependency---the value of a local variable is an application of another class object
---constants: declaration: Public static final Data type Uppercase _ = value; The value does not change throughout the software life cycle
---Member Method: A method that does not have a static adornment is called a member method of its invocation: through the object name. Member Method Name
---static method: Called by the Static Modified method: Class name. static method name----saved in a static code area
---Construction method: Used to create a method of the current class object in the class instantiation (instantiating the current class object); The default is: public, static, no return value, the name and class name of the same
---This object: 1 prefix the member variable and assign the value
2 in the constructor method, the overload calls the other constructor methods in this class, which must be written in the first row of the constructor method when the this () overload is called
3 is used to represent the object of this class, which holds the address of this class, which is located in the first memory slice in heap memory
4 in heap memory, we have the memory address of the first memory slice in the heap memory as the memory address of the entire object, and named this
---Super object: Super Represents the parent type feature in the current subclass object.
The first row must be unloaded when the constructor method overload of the subclass calls the constructor of the parent class
Super () and this () cannot recur
Super can be used to invoke the parent class's member properties and member methods
3: Class Form---System Class, Class library class, General class and inner class
The inner class is divided into 4 types: static inner class
member Inner class
Local inner class
Anonymous inner class
4: Class Inheritance---A class can only inherit from one class, and only member variables and member methods can be inherited (local variables inside the method, regardless of being inherited)
---Implements can be implemented from multiple interfaces
The override of a method in a---inheritance must be between two classes that have an inheritance relationship Override:1
2 method Name, return value type, parameter list must be the same
3 The overridden method cannot have lower access rights than the original method
4 The overridden class cannot have a broader exception than the parent class
5 Private methods cannot be overridden, even if overwritten, to access the parent class's
6 Construction methods cannot be overridden
7 static methods cannot be overridden
8 Overwrite is specifically the override of member methods, and member variables, static variables and static methods are independent
5:6 Relationships between classes and objects---inheritance, implementation, dependency (local variables are references to another class object), associations (member variables are references to another class object), aggregations (the elements in a collection in a class are references to another class object), combined
6:final---Final-modified classes cannot be inherited
The final modified method cannot be overridden
The final modified local variable cannot be assigned two times
Final-Modified member variables must be immediately assigned
The final modified static variable, which is the constant
6: Special class: Abstract class
Interface---are all abstract methods of the class is the interface, the interface has no variables only constants
Constant---Uppercase public static final AAA; Features: The lifecycle of the software does not change
Two: 4 steps of instantiation of object new Object---1 call construction method, 2 open space; 3 copy; 4 Assignment
Third: Abstract classes are abstract classes that are decorated with abstractions
Abstract classes do not necessarily have abstract methods, but abstract methods must be declared in abstract classes
Methods that have no method body are called abstract methods, that is, methods that do not have curly braces, and need to be modified with an abstract
A non-abstract class knot inherits an abstract class, and all of the abstract methods must be implemented
Neither abstract class nor abstract method can be final, because it is used to inherit the implementation, final cannot be inherited and overwrite, conflict
IV: Declaration of Interface Interface---[modifier list] Interface interface name {}
Interface Content 1 constant, PSF, but the interface is a constant by default, so the PSF can be omitted
2 All methods are abstract methods, so abstract can be omitted
There is no construction method in the 3 interface, the interface cannot be instantiated
4 interface can be multiple inheritance, extends
51 classes can inherit only one class, but multiple interfaces may be implemented
61 non-abstract classes, implementing an interface must all implement the method in the interface
Five: polymorphic polymorphism occurs at the time of assignment
Inheritance and implementation---extend,implements
To move up---the parent class refers to the child class object---the memory address of the object of the class is assigned to the reference variable of the parent class object
rewrite [email protected]
Downward transformation---must be existing upward transformation, then the downward transformation
Polymorphic 4 Forms---member method polymorphism: In the formal parameter list of the method declaration is the parent class, when the invocation of the value is a subclass of the object reference
---constructor method polymorphism: When a method declaration is constructed, it is the object reference of the child class when the parent class passes the value
---the direct instantiation of polymorphism: The time of declaration is the parent class, when instantiated is a reference to a subclass object.
---member variable polymorphism: The member variable is declared as the parent class, but when assigned, it is the object reference of the child class
VI: Object---toString () a literal description of each object to itself, default is the memory address of the output object
---hashcode () returns the memory address of the object
---equals () compares memory addresses of reference data types by default and needs to be rewritten as you want
The method that is called when the---finalize () system cleans up garbage for an object
Java-oriented Java theory object