Function Overloading in Java Program
Function Overloading
Some functions name with different arguments is function overloading.
class sans
{
void sum(int a)
{
System.out.println("The value of a is:"+a);
}
void sum(int a,int b)
{
System.out.println("The value of a+b is:"+(a+b));
}
void sum(int a,int b,int c)
{
System.out.println("The value of a+b+c is:"+(a+b+c));
}
}
class ajith
{
public Static void main(String args[])
{
sans s=new sans();
s.sum(10);
s.sum(10,20);
s.sum(10,20,30);
}
}
0 coment�rios:
Post a Comment