Thread safe java singleton
package com.journaldev.singleton;
public class BillPughSingleton {
private BillPughSingleton(){}
private static class SingletonHelper{
private static final BillPughSingleton INSTANCE = new BillPughSingleton();
}
public static BillPughSingleton getInstance(){
return SingletonHelper.INSTANCE;
}
}
Written by Ilya
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Singleton
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#