KnowledgeBoat Logo

Computer Applications

For which purpose a constructor is used?

  1. To initialise the instance variables
  2. To provide the instance variables
  3. To organise the instance variables
  4. To simplify the instance variables.

Java Constructors

48 Likes

Answer

To initialise the instance variables

Reason — A constructor is used to initialise data members with default or user-defined values at the time of creation of an object.

Answered By

28 Likes


Related Questions