package cn.my.test.avreger;
public class Singseting {
/**
* 懒汉模式
*/
private static Singseting singseting;
private Singseting (){
}
public static synchronized Singseting getSingseting (Singseting singseting){
if(singseting==null){
singseting=new Singseting();
}
return singseting;
}
}
package cn.my.test.avreger;
public class Hungry {
/**
* 饿汉模式
*/
private static Hungry hungry=new Hungry();
private Hungry(){
}
public static Hungry gethungry(){
return hungry;
}
}