Where are the inner static classes are stored in new Java versions?
If static classes are stored in heap memory/ metaspace then how the below Singleton pattern implementation is thread safe?
public class BillPughSingleton {
private BillPughSingleton(){}
private static class SingletonHelper {
private static final BillPughSingleton INSTANCE = new BillPughSingleton();
}
public static BillPughSingleton getInstance() {
return SingletonHelper.INSTANCE;
}
}