// 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 Test {
    private Test2 test2 = null;
    public Test() {
        test2 = new Test2();
    }
    public void printOK() {
        System.out.println( "OK" );
    }
    public static void main( String[] args ) {
        Test test = new Test();
    }
}

class Test2 {
    public Test2() {
        Exception ex = new Exception();
        StackTraceElement[] ste = ex.getStackTrace();
        if ( ste[1].getClassName().equals("Test") ) {
            System.out.println("haps");
        }
    }
    public Test2(Test co) {
        co.printOK();
    }
}
