public void methodA() {
String methodName = new Object() {}.getClass().getEnclosingMethod().getName();
System.out.println(methodName); //methodA
}
public void methodB() {
String methodName = new Object() {}.getClass().getEnclosingMethod().getName();
System.out.println(methodName); //methodB
}