Default constructor does not initialize the instance members of the class?

前端 未结 7 2459
清酒与你
清酒与你 2021-02-13 03:05

I encountered a question that asks \"Which of the following are true about the \"default\" constructor?\"

and an option \"It initializes the instance members of the cla

7条回答
  •  清酒与你
    2021-02-13 03:42

    Isn't the default constructor initializing the instance member name = null?

    No, constructors get called after all instance variables are initialized by the default values: 0 or the equivalent value for primitive numerical types, false for the boolean type, null for reference types.

提交回复
热议问题