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

date:2024-06-05 12:24:30 author:admin browse: 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.

支付宝转账赞助

支付宝扫一扫赞助

微信转账赞助

微信扫一扫赞助