Originally posted by mohamed hamdy:
for the following code, why when run dosen't print e.
Because the
test method in the class Sub doesn't thrown an exception. In fact, it doesn't do anything. When overriding a method in a parent class, as is done in this case, the overriding method can throw any subset of checked exceptions that the parent method throws - including the empty set. That's the case here. The key is to realize that the test method being invoked is the one within the Sub class, not the one within the Exc class.
I hope that answers your question.
Corey