The constructor method is a special method with the same method name as the class name and no return type, which is used to produce the object (which helps to produce the object).
The function of the construction method:
1, allocating space for objects
2, initialize member variables
3, returns a reference to the object
If a class does not have a construction method defined, the virtual opportunity is automatically assigned an parameterless construction method. However, if a class defines a construction method, the default parameterless construction method disappears.
Super () calls the constructor of the parent class, produces the parent class object, inherits from the parent class, and if the constructor of the parent class is not called by Super () in the subclass constructor method, the parent class object is generated. Virtual opportunity automatically adds super ().
and super () must be the first sentence of the subclass construction method. If no parameter construction method is provided in the parent class. Then the subclass must be called through Super (argument). Otherwise, the subclass cannot make a call to the parent class without a parameter construction method by the bucket super (). thereby compiling the error.
java--Construction Method