Method Overloading

Method Over loading Example:



package com.oops;
/**
 * @Author -- Ramu Chintha
 */

public class MethodOverLoading {
public static void main(String[] args) {
calculate(2,3);
calculate(2,3,6);
}

private static void calculate(int i, int j, int k) {
// TODO Auto-generated method stub
System.out.println("Three Parametes Value-->"+(i*j*k));
}

private static void calculate(int i, int j) {
// TODO Auto-generated method stub
System.out.println("Two Parameters Value-->"+(i+j));
}

}


Output:


0 comments:

Post a Comment