Why we cannot override static method

Why we cannot override static method

Answer : Overriding depends on having instance of the class because static method or field never associated with object of the class and it works independently. In java polymorphism is that you do subclass a class and objects implement these subclasses will have different behaviors for the same methods defined in the superclass and overridden in the subclasses.

Leave a Reply

Your email address will not be published. Required fields are marked *