Hi Carrie,
The reason is this. Just look at your statement
Now, we can see it is a polymorphic statement, but the actual object will be bound at run-time not at compile time.
At compile time, the compiler sees that you are declaring the super-class reference and that super-class has a method
which is throwing a checked exception. In this case you have two solutions, either you handle the checked exception or
throw the checked exception,but in this case as it is the main
thread which is called, who else will handle the exception.
That's why compiler is stopping you, that either handle the exception or declare it and let someone else handle it, even
though the actual object is the sub-class object.
If we put the statement as
In this snippet, the compiler knows that you are calling the version which is ovveriden by the sub-class and it doesn't throw
an exception so it will compile and work fine.
Hope this helps,