The conclusion of the article illustrates another approach using an inner class which is guaranteed to execute only once ensuring there is only one instance created (and is thread-safe).
The Java Language Specification (JLS) guarantees the object "instance" would not be initialised until someone calls getInstance() method.
public class Singleton {
static class SingletonHolder {
static Singleton instance = new Singleton();
}
public static Singleton getInstance() {
return SingletonHolder.instance;
}
}
Click to read article
Wiki on Initialization on Demand Holder pattern