1. Syntax
Class Subclass extends Parent class
2. Overriding the method
Write one more method to rewrite
3. Final use
Use final keyword to identify "final" meaning
Final can modify classes, methods, properties, and variables
Modifier classes are not inherited
The modification method cannot be overridden
The Modifier property is not automatically assigned the initial value and must be manually assigned
Modifier variables can only be assigned once, that is, constants
4. Use of Super
Used inside an object, you can represent the parent class object
Explicitly used in the build method only in the first row
If the subclass does not explicitly call the parent class build method, and the parent class does not have a parameterless build method, the error will be
5. Object class
5.1. ToString () method
The hash code (object address string) of the object returned when defining the ToString () method inside the object class
System.out.println (Class); Return memory address
You can represent the properties of an object by overriding the ToString () method
menu, Source--Generate toString () ...
5.2. Equals () method
Compares whether a reference to an object points to the same memory address
if (class. Equals (Class 2)) {:}
You can compare the values of two objects consistently by overriding the Equals () method
menu, Source, Generate hashcode () and Equals () ...
Inheritance of Java