A method signature is the part of a method header that uniquely identifies which method is meant. Think of it as the method’s “ID badge.”
Example
public int add(int x, int y)
The method signature is: add(int, int)
int, void, …) and access modifiers (public, private).
Java uses the signature to decide which method to call. If two methods share a name but differ in their parameter lists, that is method overloading.
// Overloaded: different parameter lists
public int findArea(int side) // square
public int findArea(int length, int width) // rectangle
These have the same name (findArea) but different signatures:
| Part of Header | In Signature? |
|---|---|
| Method name | Yes |
| Parameter types & order | Yes |
| Return type | No |
Access modifier (public/private) | No |
Identify whether two methods have the same or different signatures.
Decide if a set of methods correctly overloads (different parameter lists).
Predict which overloaded method is called for a given invocation.