ITeye博客

How to print stack trace in your java code?

standalone · 2010-10-15 10:08 · java · 编程语言 · Markdown

When debugging java code, sometimes it's important to know where you come from. So you can print current stack trace to help you.

 

1. new Exception().printStackTrace();

2. Thread.currentThread().getStackTrace(); This returns an array of StackTraceElement that represents current stack of your program.

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。