overriding applies to inheritance. It means that you have the exact same notation of a method, or a covariant return type of a method, but with different body.
The covariant return means, that the overriding class can return anything that is a subclass of the original (in class Animal it is "Object") return type. Since "String" is a subclass of "Object", we are fine.
Static methods can NOT be overwritten, because they are class methods. Only instance methods can be overwritten.
Ciao,<br /> Tommaso<br /> <br />~*~*~*~<br />There are 10 types of people, those who understand binary and those who don't.
Prasad says: But i want to know what is the difference between overriden and re-define
In one line, Overriding means polymorphism can be availed. Redefining means no polymorphism.
Polymorphism means, being able to bind subclass methog at run time using the base class reference variable. Animal ani = new Dog(); ani.eat(); //at run time Dog's eat will be selected. (if dog overrides it) This is called polymorphism.
Redefining, you can understand in case of static method. methods will be selected on behalf of what is the type of reference type instead of what object it is referring to.