1.

What would be the behaviour if one parameterized constructor is explicitly defined?(a) Compilation error(b) Compilation succeeds(c) Runtime error(d) Compilation succeeds but at the time of creating object using default constructor, it throws compilation errorThe question was asked in an international level competition.This intriguing question comes from Constructor topic in section Classes and Methods of Java

Answer»

The correct OPTION is (d) COMPILATION succeeds but at the time of creating OBJECT using default constructor, it throws compilation error

Explanation: The class compiles successfully. But the object creation of that class GIVES a compilation error.



Discussion

No Comment Found

Related InterviewSolutions