Home » Java Thread dumpStack() Method with Examples

Java Thread dumpStack() Method with Examples

by Online Tutorials Library

Java Thread dumpStack() method

The dumpStack() method of thread class prints a stack trace of the current thread to the standard error stream. It is used only for debugging.

Syntax

Return

This method does not return any value.

Example

Test it Now

Output:

Current thread: Thread[My ThreadDumpStack,6,main]  currently active threads: 1  java.lang.Exception: Stack trace  at java.lang.Thread.dumpStack(Thread.java:1336)  at TutorAspire .java.JavaDumpStackExp.main(JavaDumpStackExp.java:19)  

You may also like