
public class Singleton {
//Fields
private static Singleton instance;
//Standard default Constructor
protected Singleton(){};
//Static method for creating the single instance of the Constructor
public static Singleton Instance(){
//initialize if not already done
if(instance == null)
instance = new Singleton();
//return the initialized instance of the Singleton Class
return instance;
}
}



中级程序员
by: myxiaohu 发表于:2014-04-17 09:44:19 顶(1) | 踩(0) 回复
给力呀
回复评论