Wednesday, 14 March 2018

METHOD OVERLOADING IN JAVA


package javaapplication16;

class calculator
{

    public int sum(int x,int y)
    {
    return x+y;
    }

   public int sum(int x,int y,int z)
    {
    return x+y+z;
    }
 
 
   public double sum(double x,double y,double z)
    {
    return x+y+z;
    }
 

}




public class JavaApplication16
{

   
    public static void main(String[] args)
    {
        calculator c=new calculator();
        double r =c.sum(3, 4, 10);
       
        System.out.println("sum is "+r);
   
    }
   
}

No comments:

Post a Comment

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...