摘要: 单例模式在设计模式中也是比较常见的一种模式。 对于怎么实现单例,网上也比较多的解释,这里我就不说其中的饱汉、饿汉模式了。 1.使用静态内部类 public class Singleton { private static class SingletonHolder { private static 阅读全文
posted @ 2020-03-12 09:26 哈尼鹏 阅读(124) 评论(0) 推荐(0)