Multiple choice

What is the difference between constructor and other methods?

  1. Constructor must not have the same name as the class name, whereas the methods can have any name.

  2. Constructor must have the same name as the class name whereas the methods can have any name.

  3. Constructor can have return type whereas the methods may or may not have return methods.

  4. Constructor and the methods can be called any number of times in the object life cycle.

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

Constructor should have the class name as its name because when the object is instantiated, it will call the default constructor. The methods can have any name.