Singleton

来源:互联网 发布:c语言rand函数的用法 编辑:程序博客网 时间:2024/05/16 17:16

Objective: prevent the class is created and destroied frequently, improve the performent.

 

public class Singleton{

private singleton(){}

 

private static Singleton;

 

public static Singleton getSingleton(){

 if(singleton == null){

  new singleton();

}

 return Singleton;

}

 

 

原创粉丝点击