As is now well known the recommended way for creating a singleton in java is via an enum (see for instance here)
But (for example in this answer) it seems to be considered (by @MikeAdler who replied to me in the comments) the right thing to have the enum in the singleton class (see for instance here for a full example, or the code given below). I do not seem to really understand the need/use of this - can someone please elaborate (and preferably give the correct dialect for this idiom) ?
public class Enclosing {
    private  Enclosing() {}
    static enum Singleton {
        INSTANCE;
        private static final Enclosing  singleton = new Enclosing();
        public Enclosing getSingleton() {
            return singleton;
        }
    }
}
EDIT : one would get the singleton by Enclosing.Singleton.INSTANCE.getSingleton();
 
     
     
    