Why is it impossible to have a static method in the subclass with the same signature as in parent class?
class Parent {
public final static void fun() {
System.out.println("parent");
}
}
public class Child extends Parent {
// doesn't compile!
public static void fun() {
System.out.println("child");
}
}
I just want to find out why they allow final modifier here? We all know that static methods belong to a class and not to object, so it is impossible to override the method in the subclass. So as for me final
in redundant here.