how to overload a function java code example
Example 1: What's method overloading
Overloading mean same method name and different parameter,
it can happen in same class. it's a feature that
allows us to have more than one method with same name.
Example: sort method of Arrays class
Arrays.sort(int[] arr)
Arrays.sort(String[] arr)
....
Method overloading improves the reusability and readability.
and it's easy to remember
(one method name instead of remembering multiple method names)
Example 2: method overloading
Method overloading is providing two separate methods in a class
with the same name but different arguments, while the method return type
may or may not be different, which allows us to reuse the same method name.