java 獲取調用類的類名和方法名
java 獲取調用類的類名和方法名 ...
java 獲取調用類的類名和方法名 ...
Description Below I present you two different ways to get the current Class: Using Thread ...
獲取class名: this.getClass().getName(); 或者 Thread.currentThread().getStackTrace()[1].getClassName(); 獲取方法名: Thread.currentThread().getStackTrace ...
獲取當前方法的名稱空間、類名和方法名稱 獲取調用者類名和方法名 ...
...
很簡單,直接看代碼: ...
java獲取調用當前方法的方法名和行數String className = Thread.currentThread().getStackTrace()[2].getClassName();//調用的類名 String methodName = Thread.currentThread ...