public void printStackTrace(PrintStream out){
synchronized (out) {
    PrintWriter pw=new PrintWriter(out,false);
    printStackTrace(pw);
    pw.flush();
  }
}

public void printStackTrace ( PrintStream out ) { synchronized ( out ) { PrintWriter pw = new PrintWriter ( out , false ) ; printStackTrace ( pw ) ; pw . flush ( ) ; } }
prints the stack trace of this exception to the specified stream .
