title: Custom Exception class shows Unreachable catch block everytime
body: <p>I've created a custom Exception class that I want to use in my application:</p>
  
  <pre><code>public class MyException extends Exception {
      private static final long serialVersionUID = -2151515147355511072L;
      private String message = null;
  
      public MyException() {
          super();
      }
  
      public MyException(String message) {
          super(message);
          this.message = message;
      }
  
      public MyException(Throwable cause) {
          super(cause);
      }
  
      @Override
      public String toString() {
          return message;
      }
  
      @Override
      public String getMessage() {
          return message;
      }
  }
  </code></pre>
  
  <p>But when I try to use this class, like below, it gives a compile time error.</p>
  
  <pre><code>try {
      System.out.println("this");
  } catch (MyException  e) {
      // TODO: handle exception
  }
  </code></pre>
  
  <p>Compile time error:</p>
  
  <pre><code>Unreachable catch block for MyException . This exception is never thrown from the try statement body
  </code></pre>
  
  <p>My question is if I'm extending Exception class &amp; calling super in all constructors, then why this error is occurring?</p>