It is written everywhere that static method cannot be overriden, but when I try to reduce the access specifier say from public to protected it gives an error. for example
public class StaticOverrideFunda { public static void foo(){ System.out.println("Parent Foo"); } } public class B extends StaticOverrideFunda{ protected static void foo(){ System.out.println("Child Foo"); } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub B.foo(); } } It says
Cannot reduce the visibility of the inherited method
So insense it is following the overriding rules, how come we are saying foo is not being overridden in B class? Why do we say it is hiding/shadowing and not overriding?