How to write an Exception to a text file
<pre><code>import java.io.*;
class FileWrite 
{
 public static void main(String args[])
  {
  try{
  // Create file 
  FileWriter fstream = new FileWriter("out.txt");
  BufferedWriter out = new BufferedWriter(fstream);
  out.write("Hello Java");
  //Close the output stream
  out.close();
  }catch (Exception e){//Catch exception if any
     // CAN I WRITE THE EXCEPTION TO THE TEXT FILE
   }
  }
}
</code></pre>

<p>I am writing text to a file. Can i write the exception thrown in the <code>catch</code> block to the <code>out.txt</code> file ?</p>
