1. Call the constructor of its parent class at the first statement of the constructor method of the subclass:
If the parent class provides a constructor method, and the parent class does not have an parameterless constructor method, the subclass is required to have the same construction method. That is, the number and type of arguments for a subclass construction method must be consistent with the constructor of the parent class.
If the parent class has a default constructor, and the subclass has no explicit designation of the constructor that called the parent class, the subclass's construction method implicitly has a super () operation.
Format: Super (the invocation parameter list of the parent class constructor method)
2. Access the member domain of its parent type in a non-static member method of a subtype:
Format: Super. Member fields of the parent type
If a member field with the same name as the member field is defined in a type title of the subtype, or a local variable with the same name as the member field is defined in the current non-static member method, the mask problem of the variable with the same name is resolved by the method above.
3. Call the Member method of its parent class in a non-static member method of a subtype:
Format: Super. Member method of the parent type (call argument list)
The Member method of the parent type that is called here can be a member method that is overridden in the parent type, can be static, or it can be non-static.
Public class Testsuper { public testsuper (int a) { System.out.println ("This is a class Super ... "); } Public class extends testsuper{ Public Drive (int a) { Super(a); System.out.println ("This was a class drive ...") ; }
The super of the Java keyword