public void printStackTrace(PrintWriter pw){
  pw.println(fetchStackTrace());
}

public void printStackTrace ( PrintWriter pw ) { pw . println ( fetchStackTrace ( ) ) ; }
prints the stack trace of the root exception to a printwriter also prints the messages of all the exceptions starting from top exception to the root exception , at the top of stack trace
