很简单,直接看代码:
public void showClassAndMethod() {
System.out.println(this.getClass().getSimpleName() + ":"
+ new Exception().getStackTrace()[0].getMethodName());
}
很简单,直接看代码:
public void showClassAndMethod() {
System.out.println(this.getClass().getSimpleName() + ":"
+ new Exception().getStackTrace()[0].getMethodName());
}
转载于:https://www.cnblogs.com/acode/p/7495014.html