This set of Java Multiple Choice Questions & Answers (MCQs) focuses on “Constructor”.

date:2024-06-05 12:18:21 author:admin browse: View comments Add Collection

This set of Java Multiple Choice Questions & Answers (MCQs) focuses on “Constructor”.

This set of Java Multiple Choice Questions & Answers (MCQs) focuses on “Constructor”.

1. What is true about private constructor?

a) Private constructor ensures only one instance of a class exist at any point of time

b) Private constructor ensures multiple instances of a class exist at any point of time

c) Private constructor eases the instantiation of a class

d) Private constructor allows creating objects in other classes

Answer: a

Explanation: Object of private constructor can only be created within class. Private constructor is used in singleton pattern.

支付宝转账赞助

支付宝扫一扫赞助

微信转账赞助

微信扫一扫赞助