Let's use the super keyword for constructors in this section. We'll use the previous example here too.
In the parentDemo class, we define a constructor, parentDemo(), and add a print statement to print: Parent class constructor.
In childDemo, we define a constructor childDemo() and add a print statement to print: Child class constructor. If we want to use the parentDemo class constructor in the childDemo class, we add the super() method in the childDemo() constructor. This makes the controller invoke the constructor in the parentDemo class.
There's an important rule we need to follow when working with constructors: whenever you use a super constructor in a child constructor, it should always be the ...