What could be true about Class.getInstance() considering that it defines the getInstance() method

date:2024-06-05 12:24:30 author:admin browse: time View comments Add Collection

What could be true about Class.getInstance() considering that it defines the getInstance() method

What could be true about Class.getInstance() considering that it defines the getInstance() method?

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 constructor

Answer: d

Explanation: The method getInstance() can be used to create an object if the class doesn’t have any constructor.