Function Overloading using Parameters, Java Programming Code

Function Overloading using Parameters, Java Programming Code

public class functionOverLoading {
    // func to calc sum of 2 nums
    public static int sum(int a, int b) {
        return a + b;
    }

    // func to calc sum of 3 nums
    public static int sum(int a, int b, int c) {
        return a + b + c;
    }

    public static void main(String[] args) {
        System.out.println(sum(5, 6));
        System.out.println(sum(5, 7, 12));
    }
}


No comments:

Post a Comment

Max Sub Array Sum: Kadane's Algorithm

Code of: Max Sub Array Sum: Kadane's Algorithm. public class MaxSubArraySumKadanesALgorithm {     public static void Kadane ( int ...