0

I'm new to java and I have a question.

In java not allow to override the static methods. I think the reason is static method does not belong to any instance of the classes. But however, under the inheritance, we can obtain properties and methods (except private members) from another class. Then according to the inheritance, we should be able to inherit the static methods also. Then why they cannot be overridden? Ok. If they cannot override, why we cannot keep the static methods as final (because final methods cannot be overridden).

what is the reason for this?

Hilton
  • 337
  • 6
  • 19
  • Related https://stackoverflow.com/questions/1743715/behaviour-of-final-static-method – Guy Jan 30 '20 at 05:56
  • static methods don't belong to an object but to a class. Thus they're not inherited and don't need to be explicitly final exact the same way as interface methods don't need to be marked as public. – Nicktar Jan 30 '20 at 05:58

0 Answers0