Singleton object in java | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis
+ 2

Singleton object in java

12th Mar 2017, 6:02 PM
Arun A
Arun A - avatar
3 Respostas
+ 4
A Singleton typically has a private constructor and the single instance can be retrieved via static method. For example: public class God { private static God instance = new God(); private God() { } public static God getInstance() { return instance; } } Excuse me if you think that God is not a singleton or doesn't exist at all. :)
12th Mar 2017, 7:51 PM
Tam√°s Barta
Tam√°s Barta - avatar
and where is a question?
12th Mar 2017, 6:22 PM
What is Singleton object and when it is used?
12th Mar 2017, 6:31 PM
Arun A
Arun A - avatar