super() in Java

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

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

15条回答
  •  爱一瞬间的悲伤
    2020-11-22 05:57

    Yes, super() (lowercase) calls a constructor of the parent class. You can include arguments: super(foo, bar)

    There is also a super keyword, that you can use in methods to invoke a method of the superclass

    A quick google for "Java super" results in this

提交回复
热议问题