Java doesn\'t allow overriding of static methods but,
class stat13
{
static void show()
{
System.out.println(\"Static in base\");
}
p
No, you're not overriding anything - you're just hiding the original method.
It's unfortunate that Java allows you to call a static method via a reference. Your call it more simply written as:
next.show();
Importantly, this code would still call the original version in stat13:
public static void showStat(stat13 x)
{
x.show();
}
...
showStat(new next());
In other words, the binding to the right method is done at compile-time, and has nothing to do with the value of x - which it would normally with overriding.