Singleton: How to stop create instance via Reflection
By adding below check inside your private constructor
private Singleton() {
if( singleton != null ) {
throw new InstantiationError( "Creating of this object is not allowed." );
}
}
Define the singleton like this:
public enum Singleton {
INSTANCE
}