Browsing tag: method overloading vs method overriding

varargs in java

“varargs” argument in Java Methods


Earlier we discussed on method overloading, it gives same method name and differ by method signature.  If we are not sure about number of argument(but same type) for the method,  we can’t write one method of each combination of argument list.  Code quality recommends maximum 4 overloaded method(with same name) for easy to use and

Method overloading vs method overriding

Overloading and Overriding In Java


Method Overloading : Methods  have business logic that manipulates data(instances variable).   Methods would have method name, input arguments, return type and method body.   Sometimes we require to write two methods which are logically same but differ by input argument list.   Let us take class “Calculator”. public int add(int a, int b){ return a+ b; } public