title: Java finally block and throws exception at method level
body: <p>In <code>readFileMethod1</code>, an <code>IOException</code> is explicitly catched before throwing it at the method level to ensure that the <code>finally</code> block is executed. However, is it neccessary to catch the exception? If I remove the catch block, shown in <code>readFileMethod2</code>, does the <code>finally</code> block get executed as well?</p>
  
  <pre><code>private void readFileMethod1() throws IOException {
      try {
          // do some IO stuff
      } catch (IOException ex) {
          throw ex;
      } finally {
          // release resources
      }
  }
  
  private void readFileMethod2() throws IOException {
      try {
          // do some IO stuff
      } finally {
          // release resources
      }
  }
  </code></pre>