Singleton(单例)模式:保证一个类仅有一个实例,并提供一个访问它的全局访问点。
public class Singleton {
private static Singleton ourInstance = new Singleton(); public static Singleton getInstance() {
return ourInstance;
} private Singleton() {
}
}
http://www.cnblogs.com/rush/archive/2011/10/30/2229565.html