Runtime Polymorphism in Java | Core Java Online Concepts

This Core Java Online Concepts “Runtime Polymorphism in Java” is providing information about what is dynamic binding and how to use method overriding in runtime polymorphism concept.


 

Runtime polymorphism:

  • It is also called Dynamic binding.
  • It is method overriding technique.
  • Defining a method in Child class with the same name and same signature of its Parent class is called Method overriding.
  • We can implement dynamic binding only in “Is-A” relation.
  • More than one objects combined together to show Runtime polymorphism behavior.
  • Allowed only in Super and Sub class.

 

Note: One advantage of Runtime Polymorphism is used to update Parent class functionality in Child class if it is not sufficient.

 

  • The main advantage of Runtime polymorphism is “Accessing Child class object functionality using Parent object reference”.
    • Parent address = new Child();
    • Hostel address = new Student();
    • Owner address = new Tenant();

 

  • We know the importance of ‘C/O address’ while addressing someone.
  • The best example of dynamic binding as follows.

Runtime binding – Up casting

 

 

Share this