Get the current method name in Java
Description
The following code shows how to get the current method name.
Example
//w w w .j a va2s .com
public class Main{
public static void main(String args[]) {
System.out.println
(new Exception().getStackTrace()[0].getMethodName());
}
}
The code above generates the following result.