class A{
void process() throws Exception{
throw new Exception();
}
}
public class ExtendTest extends A{
void process(){
System.out.print("ExtendTest");
}
public static void main(String[] args) {
A a = new ExtendTest();
a.process(); //line 1
new ExtendTest().process(); // line 2
}
}
Why does this program gives an unhandled Exception at line 1? Line 1 and Line 2 are using same object.