During execution of a Java program in eclipse how to print currently executing method name?
Eg:
public class Bits {
public static void main(String[] args) {
System.out.println("method:main");
int result=TotSum(24,35);
System.out.println("total sum:" + result);
}
private static int TotSum(int i, int j) {
System.out.println("method:TotSum");
return (i+j);
}
}
Output:
method:main
method:TotSum
total sum:59
In eclipse is it possible to print the current executing method name automatically (instead of hardcoded sysout statements or logger statements in every method like the below code)?
public class Bits {
public static void main(String[] args) {
int result=TotSum(24,35);
System.out.println("total sum:" + result);
}
private static int TotSum(int i, int j) {
return (i+j);
}
}
Getting the name of the current executing method
All the answers for this question suggests to add some code to the program.
But my question is to find out current executing method without adding any code.
Like an eclipse feature for Java.