In this tutorial, we are going to write a Java program to perform the method overloading in Java Programming with practical program code and step-by-step full complete explanation.
Java program for Method overloading.
class Overloading { void sum(int a,int b) { System.out.println(a+b); } void sum(double a,double b) { System.out.println(a+b); } public static void main(String args[]) { Overloading obj=new Overloading(); obj.sum(10.5,10.5); obj.sum(20,20); } }
Output
21.0 40