// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class SingletonMess {
    public static class IntendedSingleton {
        private static IntendedSingleton instance;
        private IntendedSingleton() {
        }
        public static IntendedSingleton getInstance() {
            if(instance == null) {
                instance = new IntendedSingleton();
            }
            return instance;
        }
    }
    public static class Ooops extends IntendedSingleton {
    }
    public static void main(String[] args) {
        IntendedSingleton o1 = IntendedSingleton.getInstance();
        IntendedSingleton o2 = new Ooops();
        System.out.println(o1 instanceof IntendedSingleton);
        System.out.println(o2 instanceof IntendedSingleton);
        System.out.println(o1 == o2);
    }
}
