Defining methods with the same name and different argument or return types is called method overloading

 Features of Method overloading:

                  1. If two (or more) methods of a class (whether both declared in the same class, or both inherited by a class, or one declared and one inherited) have the same name but different signatures, then the method name is said to be overloaded.

                  2. Only the method name is reused in overloading, so method overloading is actually method name overloading.

                  3. The signature of a method consists of the name of the method and the number and types of formal parameters in particular order. A class must not declare two methods with the same signature, or a compile-time error occurs. Return types are not included in the method signature.

                  4. Overloaded methods may have arguments with different types and order of the arguments may be different.

                  5. Overloaded methods are not required to have the same return type or the list of thrown exceptions.

6. Overloading is particularly used while implementing several methods that implement similar behavior but for different data types.

7. Overloaded methods are independent methods of a class and can call each other just like any other method.

8. The order of methods also matters in overloading. i.e you can change the order of the arguments to overload a method.

9. Static methods can be overloaded

10. Private methods can be overloaded

Example:

import com.bruceeckel.simpletest.*;
import java.util.*;
 
class Tree {
  int height;
  Tree() {
    System.out.println("Planting a seedling");
    height = 0;
  }
  Tree(int i) {
    System.out.println("Creating new Tree that is "
      + i + " feet tall");
    height = i;
  }
  void info() {
    System.out.println("Tree is " + height + " feet tall");
  }
  void info(String s) {
    System.out.println(s + ": Tree is "
      + height + " feet tall");
  }
}
 
public class Overloading {
  static Test monitor = new Test();
  public static void main(String[] args) {
    for(int i = 0; i < 5; i++) {
      Tree t = new Tree(i);
      t.info();
      t.info("overloaded method");

    }