Overriding v/s Hiding

Many people have heard that you can’t override a static method. This is true – you can’t. However it is possible to write code like this: class Foo { public static void method() { System.out.println(“in Foo”); } } class Bar extends Foo { public static void method() { System.out.println(“in Bar”); } } This compiles and … Read more