Object type(here, Dog) (not the reference variable's type, here Animal), determines which overridden method is used at runtime. Dog's eat method will be called.
Object type (not the reference variable's type), determines which overridden method is used at runtime.
it is actually the definition for overriding. right? The method, which will be called is determined by the type of object at runtime, not by the refence used.
Thanks<br /> <br />Anoobkumar<br />SCJP 1.5
Warning! Way too comfortable! Do not sit! Try reading this tiny ad instead:
Gift giving made easy with the permaculture playing cards