Why does Java enforce return type compatibility for overridden static methods?
Consider the following: public class Foo { static class A { public static void doThing() { System.out.println(“the thing”); } } static class B extends A { } static class C extends B { public static void doThing() { System.out.println(“other thing”); } } public static void main(String[] args) { A.doThing(); B.doThing(); C.doThing(); } } Run it! … Read more