I have a Singleton class like this:
class Singleton {
static class SingletonHolder {
static final Singleton INSTANCE = new Singleton();
}
public static Singleton getInstance() {
return SingletonHolder.INSTANCE;
}
}
Can I call like this from other class:
Singleton dummy = new Singleton();
if yes how can I disable it? if not, then why cannot i?