In this example we will find the name of the method. Description of the method used in the example: getStackTrace: Provides programmatic access to the stack trace information printed by printStackTrace(). It returns array of StackTraceElement objects.
Get Calling Method
In this example we will find the name of the method.
Description of the method used in the example:
getStackTrace: Provides programmatic access to the stack trace information printed by
printStackTrace(). It returns array of StackTraceElement objects.
getMethodName: It returns String type name of the method containing the
execution point represented by this stack trace element.
public class GetCallingMethod {
|
Output will be displayed as: