Static Method Can't be overridden

You can't override a Static Method.

//Can't do this -> Compile time error
class Foo {
    public static void method() {
        System.out.println("in Foo");
    }
}
 
class Bar extends Foo {
    public void method() {
        System.out.println("in Bar");
    }
}

Then Why compiler sometimes talks about overriding static methods?


Children
  1. Why compiler sometimes talks about overriding static methods?

Backlinks