Using parent constructor in a child class in Java

前端 未结 3 1901
清歌不尽
清歌不尽 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:28

    You should use the super keyword.

    public ChildClass(...) {
        super(...);
    }
    

提交回复
热议问题