// 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 Caller {
    public static void test1() {
        StackTraceElement ste = (new Exception()).getStackTrace()[1];
        String clznam = ste.getClassName();
        String mthnam = ste.getMethodName();
        System.out.println(clznam + " " + mthnam);
    }
    public static void test2() {
        StackTraceElement ste = Thread.currentThread().getStackTrace()[2];
        String clznam = ste.getClassName();
        String mthnam = ste.getMethodName();
        System.out.println(clznam + " " + mthnam);
    }
    public static void main(String[] args) {
        test1();
        test2();
    }
}
