0 votes
in JAVA by
What is a singleton class in Java? What’s the benefit of making a class singleton?

1 Answer

0 votes
by

What is a singleton class in Java? What’s the benefit of making a class singleton?

1) A singleton class is a class in Java that can at most have one instance of it in an application. If new instances are created for the same class they point to the first instance created and thus have the same values for all attributes and properties.

2) Singleton classes are created to create global points of access to objects. Singleton classes find their primary usages in caching, logging, device drivers which are all entities for universal access.

Related questions

0 votes
asked Jan 24, 2020 in JAVA by rahuljain1
0 votes
asked Jan 27, 2020 in JAVA by rahuljain1
...