Since JDK1.5, you don't need an Exception to get the StackTrace,
you can get it with Thread.currentThread().getStackTrace():
public class Test2 {
public static void main(String args[]) {
new Test2().doit();
}
public void doit() {
System.out.println(
Thread.currentThread().getStackTrace()[1].getMethodName()); // output : doit
}
}