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
  }
}
Dioxin
  • 13,888
  • 5
  • 38
  • 80
Dan Grahn
  • 8,638
  • 3
  • 36
  • 71

1 Answers1

3

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

Dioxin
  • 13,888
  • 5
  • 38
  • 80
  • 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. – Dioxin 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 – Dioxin Jun 19 '14 at 14:11