Java. Removing throws declaration in overriden method, yet compiler want a try/catch blok when invoking.
<p>ppl, this is puzzling me.</p>

<p>I have a subclass and I'am overriding the inherited parent method; it's being overridden in the manner that I remove the throws clause from the method declaration.</p>

<p>Now using polymorphism, the runtime type of my instance should determine the method implementation, yet the compiler complains and wants a try/catch block around the method invocation when I try to compile, as if the superclass method is being invoked and not the subclass version?</p>

<p>I'm aware that I can remove the throws declaration or narrow down the checked exception which can be thrown; when overriding.</p>

<pre><code>class A{
    void foo()throws Exception{throw new Exception();}
}
class SubB extends A{
    @Override
    void foo(){  System.out.println("B");  }

    public static void main(String[] args) {
        A a = new SubB();
        a.foo();//compiler reports: unhandled exception type Exception?? 
    }
}
</code></pre>
