When do you need to explicitly call a superclass constructor?

You never need just

super();

That’s what will be there if you don’t specify anything else. You only need to specify the constructor to call if:

  • You want to call a superclass constructor which has parameters
  • You want to chain to another constructor in the same class instead of the superclass constructor

You claim that:

At the same time I’ve also seen instances on here where someone’s problem was not explicitly calling super().

Could you give any examples? I can’t imagine how that’s possible…

Leave a Comment