title: Throw exception inside catch clause
body: <p>I have two snippet of code :</p>
  
  <pre><code>class PreciseRethrow {
  public static void main(String[] str) {
      try {
          foo();
      } catch (NumberFormatException ife) {
          System.out.println(ife);
      }
  }
  
  static private void foo() throws NumberFormatException {
      try {
          int i = Integer.parseInt("ten");
      } catch (Exception e) {
          throw e;
      }
  }
  }
  </code></pre>
  
  <p>and :</p>
  
  <pre><code>class PreciseRethrow {
  public static void main(String[] str) {
      try {
          foo();
      } catch (NumberFormatException ife) {
          System.out.println(ife);
      }
  }
  
  static private void foo() throws NumberFormatException {
      try {
          int i = Integer.parseInt("ten");
      } catch (Exception e) {
          throw new Exception();
      }
  }
  }
  </code></pre>
  
  <p>In second case I got compile error "Unhandled exception type Exception" when I throw new Exception () in catch clause. Can You explain me Why in first case everything is ok but in second i get compile error ? In both case I throw Exception but in second case i create new instance of exception (this in only difference beetwen this two examples). Thanks for help.</p>