Multiple choice technology programming languages

Constructors are used to

  1. initialize instance variables

  2. destroy variables

  3. both (a) and (b)

  4. None of the above

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Constructors are special methods in Java used to initialize the instance variables of an object when it is created. Destructors or garbage collection handle destroying variables, so option b is incorrect.