1、获取当前类名:

Thread.currentThread().getStackTrace()[1].getClassName()

this.getClass().getSimpleName() 也可以 

 

2、获取当前方法名:

Thread.currentThread().getStackTrace()[1].getMethodName()

 

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

 

相关文章:

  • 2021-04-06
  • 2022-12-23
  • 2021-10-16
  • 2021-10-22
  • 2022-12-23
  • 2021-12-09
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2021-10-21
相关资源
相似解决方案