Method Overloading

Introduction
- Method Overloading basically implies the method with the same name but different functionality.
- Since we are having the same then how does the JVM distinguish between functions,It will check the function signature that is the number of parameters, return type
Advantages Of Using Method Overloading
- We do not have to remember the function name for every separate function.
- Makes code testing and debugging easier
Implementing It Using Java
class HelloWorld {
public static void main(String[] args) {
method_overloading object =new method_overloading();
object.add(10,20);
object.add(10,20,30);
}
}
class method_overloading{
public void add(int num1, int num2){
System.out.println(num1+num2);
}
public void add(int num1, int num2, int num3){
System.out.println(num1+num2+num3);
}
}
Output is :





