title: How to throw an Exception to the method caller inside a try catch body?
body: <p>I am not able to throw a custom exception from within a try block. The exception doesn't return back to the caller, instead jumps out of the try-catch block and executes the remaining statements (<code>return i;</code> statement in the code).
  I know that I don't need the try-catch block for the function "exceptionTester" to run. However I'd like to know the reason for this behaviour. <code>exceptionTester(0)</code> returns 0 instead of the exception being thrown.</p>
  
  <pre><code>public class Test {
  
      public static int exceptionTester(int i) throws FAException{
          try {
              if (i==0) {
                  throw new FAException("some status code", "some message", null);
              }
          } catch (Exception e) {
              // TODO: handle exception
          }
          return i;
      }
  
      public static void main(String[] args) {
  
          try {
              int in = exceptionTester(0);
              System.out.println(in);
  
          } catch (FAException e) {
              System.out.println(e.getStatusCode());
          }
      }
  }
  
  public class FAException extends Exception {
  
      private String statusCode;
  
      public FAException(String statusCode, String message, Throwable cause){
          super(message,cause);
          this.statusCode = statusCode;  
      }
      public String getStatusCode() {
         return this.statusCode;
       }
  }
  </code></pre>