1.

What is false about constructor?(a) Constructors cannot be synchronized in Java(b) Java does not provide default copy constructor(c) Constructor can have a return type(d) “this” and “super” can be used in a constructorThis question was addressed to me in examination.I would like to ask this question from Constructor topic in chapter Classes and Methods of Java

Answer»

Correct ANSWER is (c) Constructor can have a return type

The explanation: The constructor cannot have a return type. It should create and return NEW objects. HENCE it WOULD give a compilation error.



Discussion

No Comment Found

Related InterviewSolutions