That is correct. Static methods/variables only look at the reference type not the runtime type. Therefore is it's advisable to access static methods/variables with the classname and not with a reference type. Because otherwise when you change the referencetype you can invoke other methods.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
posted 8 years ago
Saibabaa Pragada wrote:Super is the output. That means, instance/static variables do not participate in Polymorphism.
same is the case with static methods because eventhough you call a static metho with a reference variable, at runtime it will be classname.staticmethodname. please Write a sample code for this and check.