How much code should one put in a constructor?

前端 未结 9 2207
一整个雨季
一整个雨季 2020-12-15 05:34

I was thinking how much code one should put in constructors in Java? I mean, very often you make helper methods, which you invoke in a constructor, but sometimes there are s

9条回答
  •  温柔的废话
    2020-12-15 06:18

    Constructor is like an Application Setup Wizard where you do only configuration. If the Instance is ready to take any (possible) Action on itself then Constructor doing well.

提交回复
热议问题