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)!