Breaking News
Home / Java / Java Snippets / Find the Calling Method in Java?

Find the Calling Method in Java?

StackTrace LookupThis snippet shows how to write a method whoCalledMe() which would be used to find the calling method. This example leverages the fact that the JVM maintains a stack wherein, it adds the method names as they are invoked, so the top method in the stack is one that would have called the current one.


Check Also

How to progamatically get the Java version?

Snippet The key here is to use the system property java.version and get minor and …

Advertisment ad adsense adlogger