access modifier overloaded method code example
Example 1: access modifier overloaded method
//Overloaded method with one argument
public void add(int input1, int input2) {
System.out.println("In method with two argument");
}
//Overloaded method with one argument
public void add(int input1) {
System.out.println("In method with one argument");
}
Example 2: can overloaded methods have different access modifiers
yes they can have different access modifiers