Multiple choice

Which two of the following statements are true about constructors? I. A constructor has no return type and is therefore a void method. II. A constructor has the same name as the class. III. A class can have more than one constructor. IV. Constructors are called like any other method.

  1. III and IV

  2. I and II

  3. II and III

  4. I and IV

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

Constructors have the same name as their class (statement II is true) and can be overloaded to provide multiple initialization options (statement III is true). Statement I is false because while constructors have no return type, they are not void methods. Statement IV is false because constructors are called automatically during object creation, not like regular methods.