member in super class is always available to all the sub classes unless the member in the super class is private.
But you can override only the instance method where the polymorphism comes into play but this is not for the static method,all you can do is you can redeclare the static method inthe sub class but that does not means overriding.Call to static method always depends on reference type where as call to overriden instance method always depends on object type at run time.
Think of like this if you have some members declared in super class and a class extend that super class,then it is almost like you declared those member in sub class and you can use them in the sub class as such you declared inthe sub class unless they are private.But if you redeclare those members in the sub class itself then polymorphism comes into play in the form of overriden whch depends on the member type(static or instance)
Siva Masilamani wrote:member in super class is always available to all the sub classes unless the member in the super class is private.
Thanks siva. you are very clear in what you said.
am aware of overriding and redeclaring concepts for static methods though thanks for your stuff which helps me to recollect those concepts.
pretty confused in area of Inheritance of static methods. i was thinking in this way "as we cannot override static methods there is no way of inheriting them". As Overriding comes into picture only if inheritance is possible.
I have the same doubt regarding the inheritance of the static methods.I know how hiding, overriding works. I also known that a static method can't be overridden, only redefined in subclases.
What is not very clear for me is if the static methods can or can't be inherited.
I tried to write many pieces of code and I came to conclusion that static methods are inherited. Regarding the inheritance concept, they only differ than instance methods when we talk about polymorphism.