2

Is it necessary or good practice to call super() when you're class only has Object as a parent?

i.e.

public class Foo {
  public Foo() {
    super();

    // Other stuff
  }
}

or

public class Foo {
  public Foo() {
    // Other stuff
  }
}
Vince
  • 14,470
  • 7
  • 39
  • 84
Dan Grahn
  • 9,044
  • 4
  • 37
  • 74

1 Answers1

3

No. It's implicitly invoked, so theres no reason to call it.

Vince
  • 14,470
  • 7
  • 39
  • 84
  • As discussed in the duplicate, there's also no reason to *ever* call it, regardless of what the parent class is. – Duncan Jones Jun 19 '14 at 14:04
  • @Duncan If the superclass's constructor requires paramerers, it's required, so I wouldn't say there's no reason to ever call it. – Vince Jun 19 '14 at 14:06
  • 1
    I believe this question is specifically related to the no-arg `super();` call. – Duncan Jones Jun 19 '14 at 14:07
  • @Duncan I'm sorry. I'm caught up in so many things, I forgot this was specific to classes that implicitly extend Object – Vince Jun 19 '14 at 14:11