Only as Learning notes
/* The constructors in a child parent class are initialized to a subclass object The constructor of the parent class also runs because the constructor of the subclass has an implicit statement super () Super (): a constructor that accesses the null parameter of the parent class.
Also, all constructors in subclasses have the default first row of super () for what subclasses must access constructors in the parent class. Because the data subclasses in the parent class can be directly fetched, so when the subclass object is established =, you need to see how the parent class initializes the data, so the subclass initializes the object by first accessing the constructor of the parent class if you want to access the constructor specified in the parent class.
You can specify the note by manually defining the Super statement: The Super statement must be an example of the first line of subclasses of a subclass constructor conclusion: All constructors of subclasses, default access constructors for null arguments of the parent class
Because the first line in each constructor function of a subclass has an implicit super. When there are no constructor functions for null arguments in the parent class, the subclass must manually access the constructor specified in the parent class through the Super statement form Of course: The first line of constructors in a subclass can also manually specify the this statement to access the constructor subclass in this class at least one constructor will access the constructor in the parent class/class Father//extends Object/This is the parent class of all classes {privat
e String word;
Father () {System.out.println ("Father 1");
} father (String word) {This.word = Word;
System.out.println ("Father 2" + word);
Class Sun extends Father {Sun () {super ();//Not write will also be implicitly called SYSTEM.OUT.PRINTLN ("Sun 1");
Sun (String word) {super (word);
System.out.println ("Sun 2" + word);
} class Extenddemo {public static void main (string []args) {string w = ' run ... ';
Sun s = new Sun (); SYSTEM.OUT.PRINTLN ("---------------");
Sun SS = New Sun (w);
}
}