Method Overloading
Method overloading is a feature of java in which one class can have more than one method with the same name but different parameter list(either data type or the number of arguments should be different). * If only return type is different then it can't be considered as function overloading. It can be
Method overloading is a feature of java in which one class can have more than one method with the same name but different parameter list(either data type or the number of arguments should be different). * If only return type is different then it can't be considered as function overloading. It can be called function overloading also. Function overloading is very useful in a class where one operation(task) can be performed with different types of arguments with the same name. Here is an example of function overloading.
Develop a Program that illustrate method overloading concept. Read about the concept here
class Object
{
public int Add(int a, int b)
{
return (a + b);
}
public int Add(int a, int b, int c)
{
return (a + b + c);
}
public int Add(int a, int b, int c, int d)
{
return (a + b + c + d);
}
}
public class Practical15
{
public static void main(String[] args)
{
Object o = new Object();
System.out.println("Add 1 => " + o.Add(4, 5));
System.out.println("Add 1 => " + o.Add(4, 5, 6));
System.out.println("Add 1 => " + o.Add(4, 5, 6, 7));
}
}
Related Posts
Continue learning with these related articles

User-Defined Methods in Java for ICSE Class 10: Parameters, Return and Overloading
ICSE Class 10 Computer Applications notes on user-defined methods: method prototype and signature, formal and actual parameters, return types, call by value vs call by reference, pure and impure methods, static methods and method overloading, with programs.

ISC Practical 2027: Image Editor – Brighten an Image and Find Bright Spots (2-D Array) – Java Program
Fully solved ISC Computer Science Practical 2027 2-D array question: brighten a grayscale image (capping values at 255) and find the bright spots, pixels larger than all four neighbours. Includes a missing bright spot in CISCE’s sample output.

ISC Practical 2027: College Enrolment Code Validator and Stream Report – Algorithm and Java Program
Fully solved ISC Computer Science Practical 2027 question: validate college enrolment codes made of a stream, year and serial number, give the exact reason for each rejection, auto-correct lowercase streams and prepare a stream-wise report.