class methover
{
void sum(int a, int b)
{
System.out.println("integer value : "+(a+b));
}
void sum(double a, double b)
{
System.out.println("double value : "+(a+b));
}
void sum(float a, float b)
{
System.out.println("float value : "+(a+b));
}
void sum(byte a, byte b)
{
System.out.println("byte value : "+(a+b));
}
void sum(short a, short b)
{
System.out.println("short value : "+(a+b));
}
void sum(long a, long b)
{
System.out.println("long value : "+(a+b));
}
void sum(String a, String b)
{
System.out.println("string value : "+(a+b));
}
public static void main(String arg[])
{
methover t = new methover();
t.sum(5,10);
t.sum(10.3,14.2);
t.sum(5.3,3.2);
t.sum(100,-50);
t.sum(10000,-20000);
t.sum(250,200);
t.sum("ssv","ksv");
}
}In this code snippet I will explain about Method Overloading in Java. It is very simple in Java Programming. The output will be displayed in the Run module.
