title: Rethrow exception in java
body: <p>I have a very simple question about re-throwing exception in Java.</p>
  
  <p>Here is the code snippet:</p>
  
  <pre><code>public static void main(String[] args) throws FileNotFoundException {
      try {
          FileReader reader = new FileReader("java.pdf");
      } catch (FileNotFoundException ex) {
          throw ex;
      }
  }
  
  public static void main(String[] args) throws FileNotFoundException {        
          FileReader reader = new FileReader("java.pdf");        
  }
  </code></pre>
  
  <p>Why do we need to re-throw <code>ex</code> in the first version while the second version looks more elegant? What might be the benefits and which version is preferred over the other?</p>