// 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) 
import java.lang.reflect.Constructor;

public class ReflectionFun {
    private static void dump(Object o) {
        System.out.printf("%s %d\n", o.getClass().getName(), o.hashCode());
    }
    public static void main(String[] args) throws Exception {
        System.setSecurityManager(new SecurityManager());
        dump(X.getInstance().hashCode());
        dump(X.getInstance().hashCode());
        dump(X.getInstance().hashCode());
        //dump(new X());
        Constructor<X> ctor = X.class.getDeclaredConstructor(new Class<?>[0]);
        ctor.setAccessible(true);
        dump(ctor.newInstance(new Object[0]));
        dump(ctor.newInstance(new Object[0]));
        dump(ctor.newInstance(new Object[0]));
    }
}
