欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

设计模式] 单例模式

最编程 2024-10-01 07:20:46
...
public class Singleton { //私有化构造函数 private Singleton(){} private static Singleton instance = null; static { instance = new Singleton(); } public static Singleton getInstance(){ return instance; } }