Can static method be overridden?

Static methods are bonded during compile time (static binding).
And hence, it resolves to reference variable and not Object. And hence, you cannot override static method.
    For e.g. - 
         Parent p = new Child();
         p.callStaticMethod();
   This method will invoke Parent class method and not Child class. 

Comments

Popular posts from this blog

@Overrride annotation introduced in Java1.5

Liskov Substitution Principle (LSP)

Marie Choco Lava