+ 1
What is singleton class??
2 Réponses
+ 3
Here:
https://en.m.wikipedia.org/wiki/Singleton_pattern
Basically Singleton pattern restricts the instantiation of a class and ensures that only one instance of the class exists in the java virtual machine. The singleton class must provide a global access point to get the instance of the class. Singleton pattern is used for logging, drivers objects, caching and thread pool.
+ 1
Declare the constructor "private" and boom you have a singleton class. So, basically there will be just one instance for that particular class. Or take a look at this, it is a better explanation than mine :D https://www.geeksforgeeks.org/singleton-class-java/