It is related to core java enums
what is singleton instances of the enumer开发者_如何学JAVAation class in java?
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.
精彩评论