I have a static method defined in a base class, I want to override this method in its child class, is it possible?
I tried this but it did not work as I expected. When I created an instance of class B and invoke its callMe() method, the static foo() method in class A is invoked.
public abstract class A {
  public static void foo() {
    System.out.println("I am base class");
  }
  public void callMe() {
    foo();
  }
}
Public class B {
  public static void foo() {
      System.out.println("I am child class");
  }
}
 
     
     
     
     
     
     
     
    