This question already has an answer here:
- use of exception in inheritance 6 answers
Given
public class ToBeTestHandleException{
static class A {
void process() throws Exception {
throw new Exception();
}
}
static class B extends A {
void process() {
System.out.println("B ");
}
}
public static void main(String[] args) {
A a = new B();
a.process();
}
}
Why we should handle the exception at line (a.process()) ?.The method process of class B does not throw exception at all? PS:This is an SCJP question.