Multiple choice technology programming languages

A constructor is used to

  1. Free memory

  2. Initialize a newly created object

  3. Import packages

  4. Create a JVM for applets

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

A constructor initializes a newly created object's state, sets initial values for fields, and can invoke the superclass constructor. Options A, C, and D are incorrect: constructors don't free memory (garbage collection does), they don't import packages (import statement does that), and JVM creation happens at runtime startup, not by constructors.