This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Static methods can never be overriden, It is always invoked based on the reference type. In your case "t" has a reference type of "Tenor" so "fa" got printed and "s" has a reference type of "Singer" so "la" got printed
Vinoth Kumar Kannan wrote:
Isn't this called over-riding? Same method with same signature in both the base class and derived class!
This is over-riding,right, irrespective of on which reference you invoke the method?
Did you run the code? If overriding, did you get virtual method invocation feature? Check it. Static methods look like they override the super class one, but, actually the are hiding. If overriding => virtual method invocation will happen in a polymorphic environment(like the situation in the OP's code line 8)!