原文:【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