Header Ads

  • Breaking Now

    Why an abstract method cannot be static?

    An abstract method is usually defined in an abstract class or an interface,for which implementation is provided in a subclass or a class implementing the interface.As static methods just have single copy per class and are interpreted at code compile time,not at runtime, so it is impossible to have polymorphic behaviour out of them.In other words, they cannot be overridden.

    An abstract class is one which cannot be instantiated but a static method defined in abstract class can be invoked without creating an instance.So there is no mechanism to ensure call of an abstract static method.

    Moreover this is a design decision by language designers. :-)


    1. More Explaination:
      * static methods are final by default.
      * final methods can't be overriden.
      * abstract methods needs to be overidden in Child class whichever extending Abstract class.


    2. An abstract class may have static fields and static methods. You can use these static members with a class reference—for example, AbstractClass.staticMethod()—as you would with any other class.
      taken from

    3. Static methods are not final by default !


    4. Interesting post. Thanks for the information


    Post Top Ad

    Post Bottom Ad