Method overloading means defining multiple methods with the same name but different parameter lists. Apex looks at the arguments you pass and picks the version that matches.
The compiler tells overloaded methods apart by their signature: the method name plus the number, types, and order of parameters. Two overloads must differ in their parameter list:
public static String format(Integer value) {
return 'Number: ' + value;
}
public static String format(String value) {
return 'Word: ' + value;
}
public static String format(String value, Integer times) {
return value + ' x' + times;
}
All three methods share the name format, but each has a different parameter list, so all three can exist together.
Changing only the return type does not create a valid overload. If two methods have the same name and the same parameter list, the code does not compile — even if one returns String and the other returns Integer.
When you call an overloaded method, Apex matches your arguments to the parameter lists:
String a = format(42); // calls the Integer version
String b = format('hello'); // calls the String version
String c = format('go', 3); // calls the two-parameter version
Overloading lets one concept keep one name, no matter what shape the input takes. Callers always call format, and the language routes each call to the right version, which keeps your code small and easy to remember.