KnowledgeBoat Logo

Computer Applications

Assertion (A): The default constructor initializes object fields to zero or null depending on their data type.

Reason (R): Java constructors are inherently tied to the initialization of an object and therefore do not specify a return type.

Java Constructors

3 Likes

Answer

Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A)

Explanation

  • Assertion (A): The default constructor initializes fields to their default values (e.g., 0 for numbers, null for objects, false for boolean).
  • Reason (R): Constructors are used for object initialization and do not have a return type.
  • The Reason explains why the default constructor initializes fields automatically.

Answered By

3 Likes


Related Questions