MCQ
Single Best Answer
Moderate
Q
[Object Oriented Programming]
What is the constructor's implicit return type?
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
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer: Option A
Explanation
[Object Oriented Programming]
What is the constructor's implicit return type?
What is the constructor's implicit return type?
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
voidis 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
voidor 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
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic