printStackTrace()有什么用?能具体解释下吗?

解决方案 »

  1.   

    Prints this throwable and its backtrace to the standard error stream. This method prints a stack trace for this Throwable object on the error output stream that is the value of the field System.err. The first line of output contains the result of the toString() method for this object. Remaining lines represent data previously recorded by the method fillInStackTrace(). The format of this information depends on the implementation, but the following example may be regarded as typical
      

  2.   

    This produces information about the sequence of methods that were called to get to the point where the exception happened. By default, the information goes to the standard error stream, but overloaded versions allow you to send the results to any other stream as well.
      

  3.   

    Stack::栈printStackTrace()递归打印
      

  4.   

    从main函数开始打印出函数的调用顺序,可以定位出错的位置