I can't understand why compiler shows an error when I try compile this code :
class A { public static void f() { System.out.println("A.f()"); } } class B extends A { public static int f() { System.out.println("B.f()"); return 0; } } the deference between the two methodes in A and B classes is the return type, I read that Java prevent overriding static methods. So what I expect is the compiler shouldn't show any error because there is not any overriding originally !!