It is because the "start()" method is overriden in class tt. Remember, Invocation of instance methods are determined by the object referred to at runtime. So at runtime it is Class tt object.
If you use the syntax "((t)new tt()).variable", then it will invoke the variable of superclass and not that of subclass. Because the invocation of variables is determined at compile time and not at runtime.
SCJP
Gitesh Ramchandani
Ranch Hand
Joined: Feb 28, 2007
Posts: 274
posted
0
Thanks Sudhakar.
I get it now that overriding method will be invoked and decided during runtime based on the object type, rather than the reference type.
Dean Jones
Ranch Hand
Joined: Dec 29, 2007
Posts: 129
posted
0
Is it becoz polymorphism only applies to instance methods?