Constructors have _____ return type.
2016
Constructors have _____ return type.
- A.
void
- B.
char
- C.
int
- D.
no
Attempted by 294 students.
Show answer & explanation
Correct answer: D
Answer: Constructors do not have a return type.
Explanation: Constructors are special routines used to initialize new objects. They are declared with the class name and are not allowed to specify any return type — not even void. If you include a return type, the compiler treats it as a regular method, not a constructor.
Example: class MyClass { MyClass() { // initialization } }
A constructor's name must match the class name.
Constructors do not return values and cannot declare a return type (not even void).
If a return type is specified, the declaration becomes a regular method and will not act as a constructor.
Use methods when you need to return values; use constructors only for initializing new objects.