posted 16 years ago
Remember this rule, When a method is overridden(thru inheritance), then during run time, depending on the object type that the referrence variable is pointing to, the correspoding type's method will be invoked.
In the current example, ref variables a, d and the casted a(line 3) are all pointing to the Dog Object , doStuff() method is overridden and hence the doStuff() method in Dog Class will be invoked.
I belive in "Judge your Java concepts by taking SCJP exam". <br /> <br />Happy preparation for SCJP 6.0