Using parent constructor in a child class in Java

前端 未结 3 1911
清歌不尽
清歌不尽 2020-12-03 20:52

I have a class \"ChildClass\" that extends the class \"ParentClass\". Rather than completely replace the constructor for the parent class, I want to call the parent class\'s

3条回答
  •  醉话见心
    2020-12-03 21:17

    To invoke a specific parent-class constructor, put super(param1, param2, ...) as the first statement in the child-class constructor body.

提交回复
热议问题