摘要: 1 /** 2 * 单例模式-线程不安全懒汉式 3 */ 4 public class SingletonTest03 { 5 public static void main(String[] args) { 6 Singleton instanceOne = Singleton.getInstan 阅读全文
posted @ 2020-10-30 23:20 树树树 阅读(274) 评论(0) 推荐(0)
摘要: 1 /** 2 * 单例模式-静态代码块饿汉式 3 */ 4 public class SingletonTest02 { 5 public static void main(String[] args) { 6 Singleton instanceOne = Singleton.getInstan 阅读全文
posted @ 2020-10-30 23:02 树树树 阅读(316) 评论(0) 推荐(0)
摘要: 1 /** 2 * 单例模式-静态常量饿汉式 3 */ 4 public class SingletonTest01 { 5 public static void main(String[] args) { 6 Singleton instanceOne = Singleton.getInstanc 阅读全文
posted @ 2020-10-30 22:47 树树树 阅读(202) 评论(0) 推荐(0)