public class PrintStackTrace {
    public static void myPrintStackTrace(Throwable th){
        System.out.println(th);
        //System.err.println(th.getClass().getName()+": "+th.getMessage());
        StackTraceElement[] st = th.getStackTrace();
        for(StackTraceElement s:st)
            System.out.println("\tat "+s.getClassName()+"."+s.getMethodName()+"("+s.getFileName()+":"
                    +s.getLineNumber()+")");
    }
}

这个方法打印后顺序会有变化这与IO流有关,还得多研究下源码

相关文章:

  • 2021-08-27
  • 2021-11-14
  • 2022-01-22
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2021-08-11
  • 2021-09-24
猜你喜欢
  • 2021-08-27
  • 2021-09-28
  • 2022-12-23
  • 2021-11-22
  • 2021-06-12
  • 2022-02-03
  • 2021-05-20
相关资源
相似解决方案