原文:【Java】+获取当前方法名 or 类名

获取当前类名: this.getClass .getSimpleName 也可以 获取当前方法名: ...

2019-08-24 11:29 0 752 推荐指数:

查看详情

Java获取当前方法名

获取class: this.getClass().getName(); 或者 Thread.currentThread().getStackTrace()[1].getClassName(); 获取方法名: Thread.currentThread().getStackTrace ...

Thu Jan 02 21:53:00 CST 2020 0 6876
java获取调用当前方法方法名和行数

java获取调用当前方法方法名和行数String className = Thread.currentThread().getStackTrace()[2].getClassName();//调用的 String methodName = Thread.currentThread ...

Thu Nov 21 21:35:00 CST 2019 0 359
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM