Java : Polymorphism

Polymorphism  :

In java we can achieve polymorphism behaviour in two ways

1. Compile time
2.run time

Compile time means object binding is done at compile time
Run time means object bind at Execution time

 Compile time means :method overloading
Run time means :  method overriding

Example :Mothod overloading Example 
Class Employee
{
  public void m1(int a)
{
   S.O.P("int args");
}
  public void m1(String str)
{
   S.O.P("String args");
}
}

Note: Method name is same but args is different



Comments

Popular posts from this blog

Angular 2 & 2+

How spring flow

database logic