MAXIMUM WITH METHOD OVERLOADING IN JAVA


************************************


 public class Maximum_with_method_Overloading

{

    public static int max(int num1,int num2)

    {

        if(num1>num2)

        return num1;

        else 

        return num2;

    }

    

    public static double max(double num1,double num2)

    {

        if(num1>num2)

        return num1;

        else

        return num2;

    }

    

    public static double max(double num1,double num2,double num3)

    {

        return max(num1,max(num2,num3));

    }

    

    public static void main (String args[])

    {

        System.out.println("int value 11 and 13");

        System.out.println("max = "+max(11,13));

        

        System.out.println("int value 21.3 and 20.9");

        System.out.println("max = "+max(21.3,20.9));

        

        System.out.println("int value 33.3,33.7,33.0");

        System.out.println("max = "+max(33.3,33.7,33.0));

    }

}


***********************************






HOMEPAGE (BLUEJ HUB) --

https://bluejhub.blogspot.com