As of java static methods cannot be overriden.while doing a small example I encountered the following situation
class MySuperclass {
public static String step2() { return "Hi"; }
}
class MyClass extends MySuperclass {
private static void step2() { }
}
When I try to compile the above code it gave me the following error message "The return type is incompatible with MySuperclass.step2()".
My doubt here is when the static methods cannot be overriden ,then why compiler bothers about the return type incompatibility.