method overloading in java method overloading example in java method overloading in java with example method overloading in java example example of method overloading in java method overloading program in java Define method overloading Definition of method overloading method overloading in java definition method overloading in java example
Method Overloading :
Method overloading in which its method name is same but its signature is different.
Signature represents the following points
a) Number of parameters
b) Types of parameters
c) Order of parameters
While we are overloading the method return type is not considered.
The Following Program illustrate the concept of Method overloading
int sum(int x,int y)
float sum(float x)
void sum(char x)
System.out.println(“this is sum method of char as formal parameter”+x);
public static void main(String args)
System.out.println(“this is main method”);
The above example in which it contains sum() method is overloaded because
all three method names are same but its signature is different. sum(int x,int y),
sum(float x), sum(char x) of same name sum and its signature number of
parameters are 2,1,1 respectively, and its Type of parameters (int,int), (float),
(char) and order of parameter is different.
Then we say that method sum() is oveloaded.