What is the return type of a constructor in Java?
A. void
B. int
C. The same as the class name
D. String
Answer: Option C
Solution (By Examveda Team)
Constructors are special methods in Java used to create objects of a class.They have the same name as the class itself.
Unlike other methods, constructors don't have an explicit return type.
Their job is to initialize the object's member variables (fields) with values.
Therefore, they implicitly return a reference to the newly created object.
The correct answer is option C, because it correctly states the return type is implicitly the same as the class name.
Join The Discussion
Comments (2)
Related Questions on Constructors and Methods
What is a constructor in Java?
A. A special method to create instances of classes
B. A method used for mathematical calculations
C. A method to perform string manipulations
D. An exception handling mechanism
In Java, which method is automatically called when an object is created?
A. start()
B. main()
C. init()
D. constructor()
What is method overloading in Java?
A. Defining multiple methods with the same name in the same class
B. Calling methods from another class
C. Using methods to load data from a file
D. Running methods in parallel threads

None of the options perfectly describe the return type of a constructor, because a constructor doesn't have a return type
Constructor will not have any written type even void.