1.

What is true about constructor?(a) It can contain return type(b) It can take any number of parameters(c) It can have any non access modifiers(d) Constructor cannot throw an exceptionThis question was posed to me in an international level competition.I would like to ask this question from Constructor topic in section Classes and Methods of Java

Answer»

The correct answer is (B) It can take any number of parameters

For explanation: Constructor returns a new object with variables defined as in the class. Instance variables are NEWLY created and only one copy of static variables are created.



Discussion

No Comment Found

Related InterviewSolutions