package com.singletone;

/**
 * 懒汉式(静态内部类)
 *
 **/
public class LazySingleTone {

    private static class lazyHolder {
        private static final LazySingleTone INSTANCE = new LazySingleTone();
    }

    private LazySingleTone() {
        if (lazyHolder.INSTANCE != null) {
        //防止反射破坏
            throw new RuntimeException("非法访问");
        }
    }

    public static final LazySingleTone getInstance() {
        return lazyHolder.INSTANCE;
    }

}