Concept of overloading
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Kavitha_L
Posted On:   Monday, April 9, 2007 03:25 AM

Explain the concept of overloading with the help of a small Java program

Reply: Concept of overloading

Posted By:   mohammed_azeem  
Posted On:   Monday, April 9, 2007 04:37 AM

overloading means method name is same but the difference should be there in the method parameters and method return type may have same or different


for example:


int add(int a, int b)


{


this.a=a; this.b=b;


int c=a+b;


return c;


}



int add(int a, int b, int c)


{


this.a=a; this.b=b; this.c=c;


int d=a+b+c;


return d;


}



float add(float a, float b)


{


this.a=a; this.b=b;


float c=a+b;


return c;


}

About | Sitemap | Contact