Can I call default constructor from parameterized constructor inside public class in java?

后端 未结 6 1328
暗喜
暗喜 2021-02-19 22:44

I want to call default constructor from a parameterized constructor inside a public java class.

Can I achieve it?

6条回答
  •  逝去的感伤
    2021-02-19 22:55

    You can't call a default constructor once you've created a constructor that takes arguments. You'll have to create the no argument constructor yourself in order to make a call from the parameterized constructor.

提交回复
热议问题