java 获取调用类的类名和方法名

转自http://yxwang0615.iteye.com/blog/998452

String classname = new Exception().getStackTrace()[1].getClassName(); //获取调用者的类名

String method_name = new Exception().getStackTrace()[1].getMethodName(); //获取调用者的方法名

猜你喜欢

转载自blog.csdn.net/feiniao8651/article/details/78149956