單例模式(線程安全+延遲加載)

public class Singleton{ spa

pirvate Singleton(){} get

private static class LazyHolder{ class

      private static final Singleton singletonInstance = new Singleton(); static

} let

public static Singleton getInstance(){ new

       return LazyHolder.singletonInstance; return

}

}

相關文章
相關標籤/搜索