用于创建唯一实例。
public class Singleton {
private static Singleton s;
static{
s = new Singleton();
}
private Singleton() {
}
public static Singleton getS() {
return s;
}
}
其他参考模式可在连接中找到
原文:https://www.cnblogs.com/heenhui2016/p/10960790.html