Java tutorial
import java.util.*; class ThreadDemo implements Runnable { public void run() { System.out.println("This is run() method"); } } public class Main { public static void main(String args[]) { ThreadDemo trace = new ThreadDemo(); Thread t = new Thread(trace); // this will call run() method t.start(); // returns a map of stack traces Map m = Thread.getAllStackTraces(); } }