单例

public class Singleton { 
 private static class Holder { // lazy class
  static final Singleton 
   instance = new Singleton();
 }
 public static Singleton getInstance() {
  return Holder.instance;   
 } 
} 

 

posted @ 2013-08-23 13:49  王 庆  阅读(204)  评论(0编辑  收藏  举报