A short summary of the question: I have a parent class which is extended by a child class.
public class Parent{
public Parent(){
//constructor logic
}
}
This child class calls the Parent’s constructor using super:
public class Child extends Parent{
public Child(){
super();
}
}
I was wondering if I were to extend the Child class if I could call the super() method in the Grandchild class’ constructor:
public class Grandchild extends Child{
public Grandchild(){
super();
}
}
super() is calling constructor one level up on the inheritance and it is called implicitly, if there is a no-arg constructor.
Objects are initialized from the top level of inheritance, in your case it is Object > Parent > Child > Grandchild.
From the documentation: