欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > > 文章正文

javase:如何在方法体内得到当前类名称以及方法名,javase体内

来源: javaer 分享于  点击 8318 次 点评:39

javase:如何在方法体内得到当前类名称以及方法名,javase体内


//获取当前类全名
String clazz = Thread.currentThread() .getStackTrace()[1].getClassName(); 
// 获得当前方法名 
String method = Thread.currentThread() .getStackTrace()[1].getMethodName(); 

System.out.println("class name: " + clazz + " Method Name " + method); 

相关文章

    暂无相关文章

用户点评