代码如下:

public void showClassAndMethod() {
        System.out.println(this.getClass().getSimpleName() + ":"
                + new Exception().getStackTrace()[0].getMethodName());
}

 

相关文章: