Java获取当前运行方法所在的类和方法名

代码以下:this

public void showClassAndMethod() {
        System.out.println(this.getClass().getSimpleName() + ":"
                + new Exception().getStackTrace()[0].getMethodName());
}
相关文章
相关标签/搜索