Hi Debasmita!
I assume you are talking about the code in the Exam Watch section which I referred to earlier. This is how I understand it:
At runtime,
both d.eat() and a.eat() will end up executing the same method, that is, the overridden version in the Dog2 class. The difference between the two function calls is the TYPE of the OBJECT REFERENCE used.
At compile time, the compiler
assumes that a.eat() will call the eat method of the Animal class (since 'a' is an Animal reference) and that d.eat() will call the overridden version of the method in the Dog2 class (since 'd' is a Dog2 reference). So, even though a.eat() will call only the Dog2 version of the method at runtime, the compiler expects an appropriate function call that corresponds to the Animal version of eat(), which throws an exception. Therefore, the above code will compile if we enclose a.eat() in a try-catch block. BUT, I repeat, at runtime, only the Dog2 version of eat is called by a.eat(). This whole exception handling process we perform is merely for the compiler's satisfaction.