Method Overloading in Java - What is Overloading, What is Compile Time Polymorphism


Method Overloading in Java - What is Overloading, What is Compile Time Polymorphism
                    Method Overloading is a kind of technique in Polymorphism. It is a technique to assign multiple task to a method or when one or more methods with same name but different signature in one or more classes are exist then this methodology is called Method Overloading.

In general life if a person is doing more then one works then those person has overload work but if that person is able to do all works assigning to him then it is very beneficial for that organization in which that person works and organization take the financial benefit. 

Example of Method Overloading in Java :-

class TestOverload
{
public int sum(int x,int y)
{
return (x+y);
}

public int sum(int x,int y,int z)
{
return (x+y+z);
}

public double sum(double x,double y)
{
return (x+y);
}


}

In above Example the "sum()" method doing the three task sum of two integer numbers, sum of three integer numbers, sum of tho real numbers.

{ 0 comments... read them below or add one }

Post a Comment