单例模式,举例如下:  
  class   Singleton  
  {  
      //   Fields  
        private   static   Singleton   instance;  
      //   Constructor  
        protected   Singleton()   {}  
      //   Methods  
        public   static   Singleton   Instance()  
      {  
            if(   instance   ==   null   )  
              instance   =   new   Singleton();  
          return   instance;  
      }   
 
Posted on 2010-02-09 14:24 邹敏 阅读(122) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理