Multiple choice

Which is true from the following options?

i. Constructors should not have the return type but the methods may or may not have a return type ii. Constructors must have the return type but the methods may or may not have return type iii. Constructors may or may not have the same name as that of the class name but methods must have the same name as that of the class name. iv. Constructors must have the same name as that of the class name, but methods may or may not have the same name as that of the class name

  1. ii. and iii. are true

  2. ii. and iv. are true

  3. i. and iii. are true

  4. i. and iv. are true

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

This answer is correct. Constructors never have return type whereas other methods may or may not have return types. Also, Constructors must have the same name as that of the class name and the other method names may or may not have the same name as that of the class name.