Home > DeveloperSection > Forums > Example of Method overloading in java?
Ankit Singh

Total Post:341

Points:2389
Posted on    October-10-2014 1:17 AM

 Java Java  OOPS 
Ratings:


 1 Reply(s)
 634  View(s)
Rate this:
method overloading in java


Kamlakar Singh
Kamlakar Singh

Total Post:194

Points:1396
Posted on    October-10-2014 1:18 AM

try this:

public int Sum(int a, int b)

        {

            return a + b;

        }

 

        public double Sum(double a, double b)

        {

            return a + b;

        }

        public int Sum(int a, int b)

        {

            return Sum(a, b, 0);

        }

 

        public int Sum(int a, int b, int c)

        {

            return a + b + c;

        }


Don't want to miss updates? Please click the below button!

Follow MindStick