0
Know the name of currently executing method in Java
This method is used to get the name of method currently executing.
Throwable t = new Throwable();
StackTraceElement[] elements = t.getStackTrace();
if (elements.length <= 0) return "[No Stack Information Available]";
// elements[0] is this method
if (elements.length < 2) return null;
return elements[1].getMethodName();
}