Hi Nirjari,
Actually the method to be called at runtime is dependent on the object instance rather than an object references. So because you are using the subclass instance, the subclass method is being called, although at compile time, the superclass method is being checked for syntax. It is for the same reason that if your superclass method was written as:
then the statement:
would not compile, as the complier would be matching it to the superclass reference.
And guess what?? If you did include the proper try and catch statement, the ouput would be "This is test method in sub class"
as the sublass instance is being used to determine the overriden method to be run at runtime.!!!