Multiple choice technology programming languages

Which of the following is not true about Constructors?

  1. The purpose of constructors is to initialize class members

  2. Constructors can have return values

  3. Constructors always have the same name as the class

  4. None of the above

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

Constructors initialize class members and share the class name. However, constructors cannot have return values - not even 'void'. This is a fundamental difference between constructors and regular methods.