what is singleton instances of the enumeration class in java?
A:
Perhaps you're talking aobut using an enum to implement the singleton pattern?
public enum Singleton {
INSTANCE;
public void singletonMethod() { ... }
}
Since enums were added to Java, this is the best (shortest, most correct) way to implement singletons.
Michael Borgwardt
2010-04-21 08:57:49