Most of the time, you probably want to understand the flow to solve certain problems. Java provides an easy approach to knowing the current stack.
Code snippet:
public class DumpStack{ public static void main(String args[]) { DumpStack dumpStack = new DumpStack(); dumpStack.proceed(); } private void proceed() { java.lang.Thread.dumpStack(); }}