Java Singleton Pattern

Singleton singleton = Singleton.getInstance();

is the correct way. Make sure your getInstance() method is indeed static.

Since your Singleton implementation is far from being safe – your object can be instantiated via reflection, you may want to create a singleton based on enum

Leave a Comment