Are static methods inherited in Java?

后端 未结 14 1562
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-22 05:08

I was reading A Programmer’s Guide to Java™ SCJP Certification by Khalid Mughal.

In the Inheritance chapter, it explains that

Inherit

14条回答
  •  春和景丽
    2020-11-22 05:53

    All the public and protected members can be inherited from any class while the default or package members can also be inherited from the class within the same package as that of the superclass. It does not depend whether it is static or non static member.

    But it is also true that static member function do not take part in dynamic binding. If the signature of that static method is same in both parent and child class then concept of Shadowing applies, not polymorphism.

提交回复
热议问题