super() in Java

前端 未结 15 2042
逝去的感伤
逝去的感伤 2020-11-22 05:36

Is super() used to call the parent constructor? Please explain super().

15条回答
  •  醉酒成梦
    2020-11-22 05:56

    Is super() is used to call the parent constructor?

    Yes.

    Pls explain about Super().

    super() is a special use of the super keyword where you call a parameterless parent constructor. In general, the super keyword can be used to call overridden methods, access hidden fields or invoke a superclass's constructor.

    Here's the official tutorial

提交回复
热议问题