MCQ Single Best Answer Moderate

Q
[Object Oriented Programming]

What is the constructor's implicit return type?

ID: #24946 Competency focused Practice Questions ISC Class XII Computer Science 4 views
Question Info
#24946Q ID
ModerateDifficulty
Competency focused Practice Questions ISC Class XII Computer ScienceTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A none
  • B void
  • C same as constructor’s signature
  • D the class type itself
Correct Answer: Option A

Explanation

[Object Oriented Programming]

What is the constructor's implicit return type?
(a) none
(b) void
(c) same as constructor’s signature
(d) the class type itself
Correct Answer: (a) none

Explanation:

In Java, a constructor is a special method used to initialize objects. It looks similar to a method, but it has some important differences.

Key Property of Constructor:

  • A constructor does not have any return type.
  • Not even void is allowed.

Example:

class Test { Test() // Constructor { System.out.println("Constructor called"); } }

Notice that the constructor:

  • Has the same name as the class
  • Does NOT contain void or any return type

Important Note:

✔ Constructor → No return type ✖ Method → Must have a return type (void or other)

Why Other Options are Wrong?

  • (b) void → Incorrect, constructors cannot have even void
  • (c) same as constructor’s signature → Incorrect concept, constructors do not return anything
  • (d) class type itself → Although constructor creates an object, it does NOT return explicitly

Common Student Mistake:

void Test() // ❌ This is NOT a constructor, it becomes a method { }

If you write void, it is treated as a normal method, not a constructor.

Conclusion:

A constructor has no return type at all.

Correct Answer: (a) none

Share This Question

Challenge a friend or share with your study group.