首页>代码>23种设计模式的java代码示例>/DesignPattern/src/dps_01_build_type/dp01_singleton/lazy/example1/Test.java
package dps_01_build_type.dp01_singleton.lazy.example1;

import dps_01_build_type.dp01_singleton.lazy.example1.LazySingleton;

/**
 * 测试类<br>
 * @author Administrator
 */
public class Test {

  /**
   * @param args
   */
  public static void main(String[] args) {
    //懒汉式单例:
    LazySingleton instance1 = LazySingleton.getInstance();
    LazySingleton instance2 = LazySingleton.getInstance();

    //从输出结果可以看出两次创建的实例是同一对象
    System.out.println("懒汉式单例:");
    System.out.println(instance1);
    System.out.println(instance2);
  }

}
最近下载更多
xb1406112453  LV5 2021年2月27日
moomin709  LV24 2020年11月17日
shoucheng  LV19 2020年6月17日
chinaboyme  LV3 2020年4月1日
yuanjh2001  LV7 2020年3月25日
MaNong码农  LV7 2020年1月4日
906396135  LV7 2019年10月31日
redredLZ  LV4 2019年10月21日
jeff2020  LV2 2019年9月28日
aisuzhen  LV10 2019年9月17日
最近浏览更多
cuiyuu  LV1 2023年2月15日
ROCK森  LV12 2022年11月7日
qijiqiji  LV1 2022年6月13日
wangdengzhe  LV7 2022年5月7日
为了水掉6位用户名  LV4 2022年3月4日
mqqiad  LV8 2021年8月22日
xb1406112453  LV5 2021年2月27日
ysy520  LV8 2020年12月2日
Azure1  LV3 2020年8月11日
卡卡罗特  LV8 2020年7月24日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友