package testsingleton;
public class TestSingleton {
private static TestSingleton testSingleton = null;
private TestSingleton(){};
public static synchronized TestSingleton getInstance(){
if (testSingleton == null) {
testSingleton = new TestSingleton();
}
return testSingleton;
}
}
单例模式
最新推荐文章于 2024-07-25 13:59:31 发布