Singleton

/**单列模式*/
public class Singleton {
private static Singleton instance = null;
public static synchronized Singleton getInstance() {
if (instance==null){
instance = new Singleton();
}
return instance;
}
}

 

 

你可能感兴趣的:(Singleton)