top of page

Polymorphism

Pholymorphism is and OOPS concept which advises the use of common interface instead of concrete implementation while writing code.When we program for interface our code is capable of Handling any new requirement or enhancement arise in near future due to new implementation of our common interface.

 

 

Rules for method overriding:

      - The argument list should be exactly the same as that of the

        overridden method.

      - The return type should be the same or a subtype of the return type

       declared in the original overridden method in the super class.

      - The access level cannot be more restrictive than the overridden

       method's access level.

      - A method declared final cannot be overridden.

      - A method declared static cannot be overridden but can be re-

     declared.

     - An overriding method can throw any uncheck exceptions,

       regardless of whether the overridden method throws exceptions or

       not. However the overriding method should not throw checked

       exceptions that are new or broader than the ones declared by the

       overridden method. The overriding method can throw narrower or

       fewer exceptions than the overridden method.

 

Title. Double click me.

I'm a paragraph. Click here to add your own text and edit me. I’m a great place for you to tell a story and let your users know a little more about you.

Using the super keyword :

 

When invoking a superclass version of and overridden method the " super " keyword is used.

bottom of page