Overidding is very specific to the context of Redifining which is a general phenomena.In java redifining can refer to Overloading or Overriding.In both cases we redifine a method but achieve different different purposes.Overidding is more than redifining,if we stress on OOPS. It relates to dynamic polymorphism or dynamic dispatch or Early/Late/Static/Dynamic Bindings.Redifinition serves no objective in OOPS,its just a general perspective to the understanding of a particular construct.
That means the static methods can't be called in the context of overriding as overriding generally done with the specific version of method being invoked based on the *actual object* created at runtime.
As such the static methods are bound to the class and NOT the instances, this does not qualify for the aforementioned rule. That's why they say the static methods are NOT overridden but redefined.
You can try with a small example program for the same. [ July 11, 2008: Message edited by: Raghavan Muthu ]
Originally posted by ansuman mohapatra: hey thanks 4 writin in...
but the doubt I have is in static methods overriding is not allowed, rather they allow method redifinition !!...That I didnt understand.
If method redefining refers to overloading or overriding then whats the difference of "Static Methods can't be overriden but can be redefined".
Its very basic to say "Static Methods can't be overriden but can be redefined". I would say that "Static method can be overidden !!,but they cant be overriden to be non-static" ie Static methods doesn't adhere to Dynamic Polymorphism or Dispatch. Take this example :
If a.meth1() calls Super class method then i dont think static method respond to dynamic dispatch calls, unlike a.meth2() which does.
Apart form saying redifining static method i would consider saying it as Hidding Static methods, because static methods are hidden not overriden. In this case Hidding/Redifining differs a lot with Overriding.