can anyone ll me why we need SUPER CLASS constructors and does it reflect to the subclasses, if so then whats the benefit of it. IF there's an abstract class in IS-A hierarchy then what's the outcome of having constructed SUPER CLASS.
Thank you ranchers good night. would like to think about it in dreams hehe
Hope you had nice dreams!! The constructor explicitly initializes the instance variables defined in the class, but it relies on the superclass constructor. And, by this time, you might be knowing that Object class is the super class for all the class. The instance variables are not initialized until after your super class constructor runs.
To invoke the superclass constructor, the constructor calls super(), which is a java keyword.
FYI The arguments pased to super() must match the parameters of the superclass constructor.
If you want constructors in your sub class , you will have to define a new one, else the compiler will provide a default one with no parameters. Hope I made some sense for your question.....