skip to main | skip to sidebar

Java Programs and Examples with Output

Pages

▼
 
  • RSS
  • Twitter
Thursday, September 20, 2012

Extract the current method name in Java

Posted by Admin at 12:07 PM – 0 comments
 

This code snippet helps to retrieve the name of the method that is currently being executed.



String methodName = Thread.currentThread().getStackTrace()[1].getMethodName(); 
//methodName wil hold the current method's name


Leave a Reply

Newer Post Older Post
Subscribe to: Post Comments ( Atom )
  • Popular
  • Recent
  • Archives
Powered by Blogger.
 
 
 
© 2011 Java Programs and Examples with Output | Designs by Web2feel & Fab Themes

Bloggerized by DheTemplate.com - Main Blogger