Method Signatures
Introduced| English | Meaning |
|---|---|
| method/ˈmeθəd/ | Functions defined as part of a Java class, providing operations on an object or the class. |
| signature/ˈsɪɡnɪtʃə/ | A Java method’s name and parameter types, which distinguish overloaded versions; return type alone does not distinguish them. |
| parameter/pəˈræmɪtə/ | A named input in a function or procedure definition that receives a supplied argument when it is called. |
| argument/ˈɑːɡjuːmənt/ | Values or references supplied to a function or procedure when it is called. |
| overloading/ˌəʊvəˈləʊdɪŋ/ | Declaring methods or constructors with the same name but different parameter lists, so the applicable version is selected from the call. |
A method's name tag
- A method 方法 is a named block of code you can call to do a job.
- Its signature 方法签名 is the part that identifies it: the name plus the parameter list.
- Example signature:
max(int a, int b)— namemax, twointparameters. - The signature is how Java knows which method you mean when you call one.
Parameters and arguments
- A parameter 形参 is a variable in the method's definition:
int ainmax(int a, int b). - An argument 实参 is the actual value you pass when calling:
max(5, 9)passes5and9. - Arguments are matched to parameters by position, left to right.
- Inside the method, the parameters hold copies of the arguments.

The parts of a method signature and a call that matches it
The return type
- A method's return type says what kind of value it hands back.
public int max(int a, int b)returns anint; avoidmethod returns nothing.- Use
return value;to send a result back to the caller. - The return type is part of the header but not part of the signature.
Overloading: same name, different signature
- Java allows overloading 重载: several methods with the same name but different parameter lists.
print(int x)andprint(String s)are distinct — the argument types tell them apart.- The compiler picks the version whose signature matches your arguments.
- Overloading only works when the signatures differ (return type alone is not enough).
The signature is name + parameter list — the return type is NOT part of it. That's why you can't overload two methods that differ only by return type. Parameters live in the definition; arguments are the values you pass, matched by position. Passing the wrong number or type of arguments is a compile error.
Calling max:
- Definition:
public int max(int a, int b) { return a > b ? a : b; } - Call:
int m = max(5, 9);→ argument5→ parametera,9→b. - The method returns
9, stored inm.
A method signature is its name plus parameter list (the return type is not part of it). Parameters are the definition's variables; arguments are the values passed at a call, matched by position. Overloading allows the same name with different parameter lists, distinguished by the arguments.
A method call returns a value
Arguments 5 and 9 bind to parameters a and b; the method returns 9.
A method's signature consists of its...
Difficulty 1/5 · 100 coins + a small bonus on first completion today
Signature = name + parameters; the return type is not part of it.
In max(5, 9), the values 5 and 9 are the...
Difficulty 1/5 · 100 coins + a small bonus on first completion today
Arguments are the values passed; parameters live in the definition.
You can overload two methods that differ only in their return type.
Difficulty 1/5 · 100 coins + a small bonus on first completion today
The return type isn't part of the signature, so that's not allowed.
Having several methods with the same name but different parameter lists is called...
Difficulty 1/5 · 100 coins + a small bonus on first completion today
Overloading = same name, different parameter lists.
Arguments are matched to parameters by their ___ (one word), left to right.
Difficulty 1/5 · 100 coins + a small bonus on first completion today
Positional matching: first argument → first parameter.