package com.sinosoft.test;
/**
* 使用饿汉模式创建单例模式
*/
public class HungrySingleton {
private static HungrySingleton instance=new HungrySingleton();
public static HungrySingleton getInstance(){
return instance;
}
private HungrySingleton(){
}
}
package com.sinosoft.test;
/**
* 使用饿汉模式创建单例模式
*/
public class HungrySingleton {
private static HungrySingleton instance=new HungrySingleton();
public static HungrySingleton getInstance(){
return instance;
}
private HungrySingleton(){
}
}