标签:out for sys classname gets stack tst throwable 调用
String classname = new Exception().getStackTrace()[1].getClassName(); //获取调用者的类名 String method_name = new Exception().getStackTrace()[1].getMethodName(); //获取调用者的方法名
StackTraceElement[] stacks = (new Throwable()).getStackTrace(); for (StackTraceElement stack : stacks) { System.out.println(stack.getClassName() + "-" + stack.getMethodName()); }
标签:out for sys classname gets stack tst throwable 调用
原文地址:https://www.cnblogs.com/zouhao/p/13024221.html