In Java, I want to get the stack trace of how the calls were made to which methods. How can I achieve that?
For example, my call stack is:
class Example {
public void init() {
func1();
// TODO : now here I want to print the stack trace that it went from:
// func1
// func2
// func3
}
public void func1() {
func2();
}
public void func2() {
func3();
}
public void func3() {
// some code here
}
}