Page 14 - JAVA Programming
P. 14

13




               Polymorphism


                     Polymorphism in Java occurs when there are one or more classes or
                       objects related to each other by inheritance. In other words, it is the
                       ability of an object to take many forms. Inheritance lets users inherit
                       attributes and methods, and polymorphism uses these methods for
                       performing  different  tasks.  So,  the  goal  is  communication  but  the
                       approach is different.

               Dynamic Binding


                     Binding  refers  to  the  linking  of  a  procedure  call  to  the  procedure
                       definition (code) to be executed in response to the call.
                       Binding  is  classified  as  static  binding  and  dynamic  binding  as
                       explained below:

                              i.     Static Binding means that the code associated with the
                                     given procedure call is known as compile time.

                              ii.    Dynamic Binding means the code associated with given
                                     procedure call is know until the time of the call at run time.
                                     Dynamic binding with polymorphism and Inheritance
   9   10   11   12   13   14   15   16   17   18   19