class Animal {
static void doStuff() {
System.out.print("a ");
}
}
class Dog extends Animal {
static void dostuff() { // it's a redefinition,
// not an override
System.out.print("d ");
}
public static void main(
String [] args) {
Animal [] a = {new Animal(), new Dog(), new Animal()};
for(int x = 0; x < a.length; x++)
a[x].doStuff(); // invoke the static method
}
}
Running this code produces the output:
a a a
---------------------------------------------------------------------------
In the above code it is said that static methods are redefined not overridden, and the output is also showing that the methods are not overriden but I am still confused that does redefining here means "Overloading".