Any constructor must explicitly initialize all fields of a class. (Java)
Is this statement true or false? And Can someone please explain why? I do not understand the question.
Any constructor must explicitly initialize all fields of a class. (Java)
Is this statement true or false? And Can someone please explain why? I do not understand the question.
This statement is false, because all the fields of a class are initialized to their default type values. A reference on an object is initialized to null
, an int
to 0
, a double to 0.0
etc...