title: Why Java return statment inside the catch block not working?
body: <p>Why does the following code always return true even when an exception is thrown?</p>
  
  <pre><code>public boolean write (ArrayList&lt;String&gt; inputText, String locationToSave){
  
      try {           
          File fileDir = new File(locationToSave);
          Writer out = new BufferedWriter(new OutputStreamWriter(
          new FileOutputStream(fileDir), "utf8"));
  
          int index = 0;
          int size = inputText.size();
          while (index &lt; size) {
                      out.append(inputText.get(index));
                      out.append("\n");
                      index++;
                      }
          out.flush();
          out.close();
  
          return true;
  
     } catch (UnsupportedEncodingException e) {
          System.out.println("UnsupportedEncodingException is : \n" + e.getMessage());
          return false;
     } catch (IOException e) {
          System.out.println("IOException is : \n" + e.getMessage());
          return false;
     } catch (Exception e) {
          System.out.println("Exception is : \n" + e.getMessage());
          return false;
     }
  }
  </code></pre>
  
  <hr>
  
  <p>Edition 01</p>
  
  <p>This is the code I'm using to test the previous code:</p>
  
  <pre><code> if (fileReader.write(fileReader.read(selectedFile), selectedSaveLocation)) {
          System.out.println("The file : " + selectedFile + " as been successfully"
          + "converted to : " + selectedSaveLocation );
      } else {
          System.out.println("The file : " + selectedFile + " failed to convert!" );
      }
  </code></pre>