1.

What is true about Class.getInstance()?(a) Class.getInstance calls the constructor(b) Class.getInstance is same as new operator(c) Class.getInstance needs to have matching constructor(d) Class.getInstance creates object if class does not have any constructorI have been asked this question in class test.The origin of the question is Constructor topic in chapter Classes and Methods of Java

Answer»

The CORRECT ANSWER is (d) Class.GETINSTANCE creates object if class does not have any constructor

The EXPLANATION is: Class class provides list of methods for use LIKE getInstance().



Discussion

No Comment Found

Related InterviewSolutions