码迷,mamicode.com
首页 > 其他好文 > 详细

1.单例模式

时间:2019-01-29 23:10:21      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:nal   color   私有   bsp   获取   pre   final   方法   vat   

1.私有的构造方法。

2.自行实例化对象

3.提供对外获取对象的方法或参数。

public class Single {

    public static final Single single = new Single();

    private Single(){

    }

}

 

1.单例模式

标签:nal   color   私有   bsp   获取   pre   final   方法   vat   

原文地址:https://www.cnblogs.com/weisifan/p/10335991.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!