Why doesn't Java allow overriding of static methods?

后端 未结 22 3105
谎友^
谎友^ 2020-11-21 05:49

Why is it not possible to override static methods?

If possible, please use an example.

22条回答
  •  生来不讨喜
    2020-11-21 06:30

    Answer of this question is simple, the method or variable marked as static belongs to the class only, So that static method cannot be inherited in the sub class because they belong to the super class only.

提交回复
热议问题