Online Java Compiler By
JavaTpoint.com
public class JavaDumpStackExp { public static void main(String[] args) { Thread thread = Thread.currentThread(); thread.setName("My ThreadDumpStack"); // set thread priority to 6 thread.setPriority(6); // prints the current thread System.out.println("Current thread: " + thread); int count = Thread.activeCount(); System.out.println("currently active threads: " + count); // prints a stack trace of the current thread to the standard error stream, used for debugging Thread.dumpStack(); } }
Output