首页 > 代码库 > 入住博客园

入住博客园

入住博客园,先秀段代码:

 1 public class Singleton {
 2 
 3     private static Singleton instance ;
 4 
 5 
 6     private Singleton() {
 7     }
 8 
 9 
10     public synchronized Singleton getInstance(){
11         if(null==instance){
12             instance = new Singleton();
13         }
14         return instance;
15     }
16 }