Untitled Document

Subscribe here to get updates on new Videos

 

14. Difference between Overloading and Overriding (part-I) ?

 

 

 

previous homenext

 

Overloading:

Two methods are said to be overloaded if and only if both methods having the same name but different argument types.

Overriding:

What ever methods parent has by default available to the child through inheritance. some times child may not satisfy with parent method implementation. then child is allow to redefine that method based on its requirement. this process is called overriding.

The parent class method which is overridden is called overridden method.

The child class method which is overriding is called overriding method.

Program:

class p
{
public void property()
{
System.out.println(“cash+Land+Gold”);
}
public void marry()
{
System.out.println(“subbaluxmi”);
}
}
class c extends p
{
public void marry()
{
System.out.println(“3Sha|9tara|4me”)
}
}