title: Java - If I return in a catch block, will the finally block be executed?
body: <p>This is what I'm trying to do:</p>
  
  <pre><code>try {
  
      //code
  } catch (Exception e) {
  
      return false;
  } finally {
  
      //close resources
  }
  </code></pre>
  
  <p>Will this work? Is it bad practice? Would it be better doing this:</p>
  
  <pre><code>boolean inserted = true;
  
  try {
  
      //code
  } catch (Exception e) {
  
      inserted = false;
  } finally {
  
      //close resources
  }
  
  return inserted;
  </code></pre>