title: Invoking overriding method that throws Checked exception
body: <p>After reading <a href="https://stackoverflow.com/questions/5875414/why-cant-overriding-methods-throw-exceptions-broader-than-the-overridden-method">Why can't overriding methods throw exceptions</a>, I understand that if method declared as throws a Checked exception, the overriding method in a subclass can only declare to throw that exception or its subclass:</p>
  
  <pre><code>class A {
     public void foo() throws IOException {..}
  }
  
  class B extends A {
     @Override
     public void foo() throws SocketException {..} // allowed
  
     @Override
     public void foo() throws SQLException {..} // NOT allowed
  }
  </code></pre>
  
  <p>So because <code>SocketException</code> IS-A <code>IOException</code> I can declare the overriding method as throws any of subclass of <code>IOException</code>.</p>
  
  <p>In my program, I want to invoke the overriding method declared as throws <code>FileNotFoundException</code> IS-A <code>IOException</code>. also handled with a try-catch block</p>
  
  <pre><code>import java.io.*;
  class Sub extends Super{
      public static void main (String [] args){
          Super p = new Sub();
          try {
              p.doStuff();
          }catch(FileNotFoundException e){
  
          }
      }
      public void doStuff() throws FileNotFoundException{}
  }
  
  class Super{
      public void doStuff() throws IOException{}
  }
  </code></pre>
  
  <p>But I am getting that compile-time error:
  <a href="https://i.stack.imgur.com/3jHka.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3jHka.png" alt="Screenshot"></a></p>
  
  <pre><code>Sub.java:6: error: unreported exception IOException; must be caught or declared to be thrown
                      p.doStuff();
                               ^
  </code></pre>
  
  <p>What is the reason for that? I'm a little confused because everything that the Base class has also available to the subclasses.</p>
  
  <p>Also much more confusing is the ability to catch <code>Exception</code> and <code>Throwable</code> In addition to <code>IOException</code> (The opposite from Overriding concept).</p>