Java MCQ: What is the implicit return type of a constructor?
a) No return type
b) void
c) Object
d) Class type
Answer:
a) No return type
Explanation:
Constructors in Java do not have a return type, not even void
. They are used to initialize objects when they are created, and the return type is implicit as the constructor returns the object of the class it belongs to.
Reference links:
https://www.rameshfadatare.com/learn-java-programming/
https://www.javaguides.net/p/java-tutorial-learn-java-programming.html