1.09 Method Signatures
Identify return types, method names, and parameters from method signatures to understand what a method does and what it needs.
1. Reference Guide
A method’s signature decides which method Java runs. Knowing exactly what is (and is not) in a signature is the key to reading APIs and writing overloaded methods.
Key Topics
| Term | Definition | Example |
|---|---|---|
| Method | A named block of code that only runs when it is called. | add(3, 4); |
| Method header | The first line of a method: modifiers, return type, name, parameter list. | public static int add(int a, int b) |
| Method signature | Method name + ordered list of parameter types (AP scope). | add(int, int) |
| Parameter | A variable in the method header. It receives a value. | int a |
| Argument | The actual value passed in the method call. | add(3, 4) (3 and 4) |
| Return type | The type of value the method gives back, or void for none. Not part of the signature. |
int |
| Overloading | Same method name, different parameter lists in one class. | add(int) and add(int, int) |
| Procedural abstraction | Using a method by knowing what it does, not how it is written. | Math.abs(-5) |
| Call by value | A primitive parameter gets a copy of the argument, so changing it does not change the original. | bump(x) leaves x alone |
What is in a Signature?
| Part of the header | Example | In the signature? |
|---|---|---|
| Access modifier | public |
No |
static keyword |
static |
No |
| Return type | int |
No |
| Method name | add |
Yes |
| Parameter types (in order) | int, int |
Yes |
| Parameter names | a, b |
No |
Picking the Right Method
- Count the arguments, then check order, then check types.
- Exact type match wins. If there is none, Java widens (
inttodouble). - Java never narrows on its own (
doubletointneeds a cast). - Same name + same parameter types + different return type = compile error.
2. LxD Cycle Process
Empathize: Students often include the return type, access modifier, or parameter names when identifying a signature. They may also use parameter and argument interchangeably, confuse overloading with overriding, or expect Java to choose an overload from the return type.
Define:
- POV: Beginning Java students need a consistent way to reduce a full method header to its name and ordered parameter types, because visually prominent words such as
public,static, andintcan distract from the parts Java uses to tell overloads apart. - Learning Issue: Students need to connect a call’s argument count, order, and compatible types to the parameter list before predicting which overload runs.
- Learning Goal: Students will reduce a method header to its signature, tell parameters from arguments, explain call by value, and predict which overloaded method a call runs.
Ideate:
- HMW Question: How might we make the signature-bearing parts of a method header visible while fading the parts that do not belong to the signature?
- HMW Question: How might we let students test an overload prediction before the compiler reveals the answer?
- Activity: Color-code several method headers, write each reduced signature, and match calls to overloads. Include one pair that differs only by return type and explain why it cannot compile.
Prototype:
- A reference guide, runnable Java examples, a signature-detective popcorn hack, an MCQ knowledge check, and a scaffolded area-method rubric.
- Students revise their predictions after seeing the runner output.
- Excellence means explaining why a call picks a given overload, not only getting the output right.
Test:
- Ask a partner to annotate one unfamiliar header and predict two calls without extra explanation.
- Record whether the partner used names, return types, or modifiers incorrectly.
- Revise the visual cue or example that caused the confusion.
- On submission, collect evidence from runner output, MCQ results, AI grading, and student explanations.
- After teaching, grading, and analysis, come back and revise the lesson to complete the teaching cycle for continuous improvement.
3. College Board Requirements
AP CSA Unit 1, Topic 1.9 Method Signatures. From the course and exam description (College Board, 2025, p. 41): a method signature includes “the method name and the ordered list” of parameter types.
This lesson covers these Topic 1.9 ideas (paraphrased; check exact wording and numbering in the CED):
- A method is a named block of code that runs only when it is called, and procedural abstraction lets you use a method without knowing how it is written.
- A method signature is the method name plus the ordered list of parameter types. A method with no parameters has the name and an empty parameter list, such as
reset(). - Parameters are the variables in the method header. Arguments are the values passed in the call. The parameter list sets how many values, in what order, and of what types a call must supply.
- Call by value: when an argument is a primitive value, the parameter starts as a copy of it, so changes to the parameter do not affect the original variable.
- Methods are overloaded when they share a name but have different signatures. Java chooses the overload that matches the call’s arguments.
- The return type (including
void) is not part of the signature, so two methods cannot differ only by return type (Gosling et al., 2025, §§8.4.2, 8.4.9).
4. Lesson Plan
Learning Objective: Identify the parts of a method signature, tell parameters from arguments, and predict which overload gets called.
Success Criteria: Given a method header, you can state its signature and say whether another method could legally overload it.
Tech Talk (5 minutes)
A method header has four parts, but Java only uses two of them to tell methods apart.
public static int add(int a, int b)
| Part | Example | Note |
|---|---|---|
| Access modifier | public |
Not part of the signature |
| Return type | int |
Not part of the signature |
| Method name | add |
Part of the signature |
| Parameter list | (int a, int b) |
Types and order are part of the signature |
Signature: add(int, int). Two methods can share a name only if their parameter lists differ. That is overloading.
Code Runner Challenge
Run it, then change an argument and predict which overload runs.
Code Runner Challenge
Run it, then change an argument and predict the new output
View IPYNB Source
// CODE_RUNNER: Run it, then change an argument and predict the new output
public class SigDemo {
public static int add(int a, int b) { return a + b; } // add(int, int)
public static double add(double a, double b) { return a + b; } // add(double, double)
public static int add(int a) { return a + 1; } // add(int)
public static void main(String[] args) {
System.out.println(add(3, 4)); // 7 -> add(int, int)
System.out.println(add(3.0, 4)); // 7.0 -> add(double, double), 4 widens
System.out.println(add(5)); // 6 -> add(int)
}
}
SigDemo.main(null);
5. Code Examples
A. Parameters vs arguments, and call by value
The ParamDemo class shows where parameters and arguments live, and that a primitive argument is copied.
Two words that get mixed up a lot:
Code Runner Challenge
Run it, then change the argument to addFive and predict what main prints
View IPYNB Source
public static void greet(String name, int times) // name and times are PARAMETERS
greet("Sam", 2); // "Sam" and 2 are ARGUMENTS
Terminology: The signature of greet is greet(String, int). Parameter names are not part of it.
Code Runner Challenge
Run it, then add a call that has no matching overload and read the compiler error
View IPYNB Source
// CODE_RUNNER: Run it, then change the argument to addFive and predict what main prints
public class ParamDemo {
// name and times are parameters
public static void greet(String name, int times) {
for (int i = 0; i < times; i++) {
System.out.println("Hello, " + name + "!");
}
}
// number is a copy of whatever argument is passed in
public static void addFive(int number) {
number = number + 5;
System.out.println("Inside addFive: " + number);
}
public static void main(String[] args) {
greet("Sam", 2); // "Sam" and 2 are arguments
int score = 10;
addFive(score); // score is copied into number
System.out.println("Back in main: " + score); // still 10
}
}
ParamDemo.main(null);
B. Overload resolution
The OverloadDemo class has several show methods. Java picks one by looking at the number, order, and types of the arguments.
Common overload mistakes:
Code Runner Challenge
Run it, then uncomment the illegal method and read the compiler error
View IPYNB Source
show(3, "a") // matches show(int, String)
show("a", 3) // matches show(String, int): order matters
half(9) // no half(int), so the int 9 widens to 9.0 for half(double)
Terminology: Java widens int to double automatically, but it never narrows double to int without a cast.
Code Runner Challenge
Replace every "?" with your answer, then run it and compare
View IPYNB Source
// CODE_RUNNER: Run it, then add a call that has no matching overload and read the compiler error
public class OverloadDemo {
public static void show(int x) { System.out.println("show(int): " + x); }
public static void show(double x) { System.out.println("show(double): " + x); }
public static void show(String s) { System.out.println("show(String): " + s); }
public static void show(int x, String s) { System.out.println("show(int, String): " + x + s); }
public static void show(String s, int x) { System.out.println("show(String, int): " + s + x); }
public static double half(double x) { return x / 2; }
public static void main(String[] args) {
show(7); // exact match: show(int)
show(7.5); // exact match: show(double)
show("hi"); // exact match: show(String)
show(3, "a"); // show(int, String)
show("a", 3); // show(String, int): order matters
System.out.println(half(9)); // 4.5, the int 9 widens to 9.0
// show(true); // ERROR: no show(boolean) exists
}
}
OverloadDemo.main(null);
C. The return type is not part of the signature
The ReturnTypeDemo class has two legal total methods. A third one that changes only the return type would not compile.
Terminology: total(int, int) and total(double, double) have different signatures, so both can exist. int total(int, int) and double total(int, int) have the same signature, so Java rejects the second one.
Code Runner Challenge
Finish the overloaded methods, fill in the comments, then run it
View IPYNB Source
// CODE_RUNNER: Run it, then uncomment the illegal method and read the compiler error
public class ReturnTypeDemo {
public static int total(int a, int b) { return a + b; } // total(int, int)
// Same name + same parameters, only the return type differs:
// public static double total(int a, int b) { return a + b; } // compile error
public static double total(double a, double b) { return a + b; } // total(double, double), legal
public static void main(String[] args) {
System.out.println(total(2, 3)); // 5 -> total(int, int)
System.out.println(total(2.5, 3)); // 5.5 -> total(double, double)
}
}
ReturnTypeDemo.main(null);
6. Hacks & Practice Tasks
Prepare your submission IPYNB
- Create a new notebook in your portfolio homework area:
_notebooks/homework. - Add one raw cell at the top with the frontmatter.
- Add code cells for the Popcorn Hack and the Homework Hack. Make sure every cell runs with visible output.
- Submit the link to your published page at the bottom of this page, and paste this in the description box:
Lesson: CSA 1.09 Method Signatures
MCQ 1.09: <paste your score line, such as 4/5 | answers: B,C,A,D,B>
Popcorn: three signatures written and four overload predictions made, runs and prints
Homework: area(double) and area(int, int) implemented with signature comments (yes/no)
Homework: area(3.0) = <value>, area(3, 4) = <value>
Homework: area(3) calls <signature> because <reason>
Submission Safety Rules (Read First)
- One class per cell, ending with
ClassName.main(null);. - Run each cell and leave the output showing.
- Write your own answers, not the sample code from the lesson.
- Include your MCQ score.
- Use
##headings or smaller.
Popcorn Hack (In-Class)
2-minute challenge: be the signature detective.
- Write the signature for each of the three headers.
- Predict which overload (A, B, C, or D) each of the four calls runs.
- Run the cell and compare your guesses with the real output.
Replace every "?" with your own answer.
// CODE_RUNNER: Replace every "?" with your answer, then run it and compare
//SignatureDetective
public class SignatureDetective {
// Part 1: write each signature (name + parameter types only)
// public int getScore(String name) ->
String sig1 = "?";
// public static double average(double a, double b) ->
String sig2 = "?";
// private void reset() ->
String sig3 = "?";
// Part 2: four overloads
public static String pick(int x) { return "A"; }
public static String pick(double x) { return "B"; }
public static String pick(int x, int y) { return "C"; }
public static String pick(String s) { return "D"; }
// Predict the letter each call prints BEFORE you run
String guess1 = "?"; // pick(4)
String guess2 = "?"; // pick(4.0)
String guess3 = "?"; // pick(4, 5)
String guess4 = "?"; // pick("4")
public static void main(String[] args) {
SignatureDetective d = new SignatureDetective();
System.out.println("Signatures: " + d.sig1 + " | " + d.sig2 + " | " + d.sig3);
System.out.println("Your guesses: " + d.guess1 + d.guess2 + d.guess3 + d.guess4);
System.out.println("Actual: " + pick(4) + pick(4.0) + pick(4, 5) + pick("4"));
}
}
SignatureDetective.main(null);
MCQ Check
5 questions, one at a time. Answer, check, then go to the next one. At the end, copy your score line (for example 4/5 | answers: B,C,A,D,B) into your submission notes.
Question 1 of 5
What is the signature of public static int add(int a, int b)?
- A.
public static add(int, int) - B.
add(int, int) - C.
int add(int a, int b) - D.
add(a, b)
Check answer
**B.** The signature is only the name and the ordered parameter types. Modifiers, return type, and parameter names are not included.Question 2 of 5
Given static int square(int n) and the call int r = square(4);, which one is the argument?
- A.
n - B.
square - C.
4 - D.
r
Check answer
**C.** `n` is the parameter (in the header). `4` is the argument (the value passed in the call).Question 3 of 5
Which pair of methods can legally exist in the same class?
- A.
void show(int a, String b)andvoid show(String a, int b) - B.
int calc(int x)anddouble calc(int x) - C.
void show(int a)andvoid show(int b) - D.
public void go()andprivate void go()
Check answer
**A.** The parameter types are in a different order, so the signatures differ. B differs only by return type, C only by parameter name, and D only by access modifier, so those are all compile errors.Question 4 of 5
A class has static String label(double x) and static String label(String s). What happens with the call label(5)?
- A. It calls
label(String) - B. Compile error
- C. Runtime exception
- D. It calls
label(double), and 5 widens to 5.0
Check answer
**D.** No `label(int)` exists, so Java widens the `int` to a `double` and uses `label(double)`.Question 5 of 5
static void bump(int n) { n = n + 1; }
// in main:
int x = 5;
bump(x);
System.out.println(x);
What prints?
- A. 6
- B. 5
- C. Compile error
- D. 1
Check answer
**B.** Call by value: `n` is a copy of `x`. Changing the copy does not change `x`.Homework Hack
Task: Finish the two overloaded area methods. Above each method, write its signature in a comment. Then run the calls in main. For the third call, area(3), write a one-line comment explaining which overload runs and why.
// CODE_RUNNER: Finish the overloaded methods, fill in the comments, then run it
public class HomeworkStarter {
// Signature: ?
public static double area(double radius) {
return 0.0; // TODO: circle area (use Math.PI)
}
// Signature: ?
public static int area(int width, int height) {
return 0; // TODO: rectangle area
}
public static void main(String[] args) {
System.out.println(area(3.0)); // expected: ~28.27
System.out.println(area(3, 4)); // expected: 12
System.out.println(area(3)); // predict first
// My answer for area(3): ?
}
}
HomeworkStarter.main(null);
Grading Plan (1 Point Total)
| Part | Points | What earns the points |
|---|---|---|
| Popcorn | 0.2 | Three signatures written correctly, four overload predictions made, and the cell runs. |
| MCQ | 0.2 | 4 or 5 correct. 0.15 for 3, 0.1 if every question was answered. |
| Homework: circle area | 0.15 | area(double) returns the correct circle area and area(3.0) prints it. |
| Homework: rectangle area | 0.15 | area(int, int) returns the correct rectangle area and area(3, 4) prints 12. |
| Homework: signature comments | 0.15 | Signature comment above each method is correct (name + parameter types only). |
| Homework: overload explanation | 0.15 | Comment for area(3) correctly says area(double) runs because the int widens to double. |
| Total | 1.0 |
Quick Validation Checklist
- Each cell ends with
ClassName.main(null);and shows output. - MCQ score in the notes.
- Three signatures written without return types, modifiers, or parameter names.
- Both
areamethods implemented, each with a signature comment. - One-line explanation for the
area(3)call.
7. Lesson Revisions
Revision Made: Cut down wording to make concepts clearer and quicker to learn, and made the grading and assignment more accessible for AI grading of the popcorn hacks.
8. Feedback Evidence
Feedback Received: The lesson should be more concise and less repetitive. The popcorn hacks should be more interactive instead of a simple FRQ-style question and answer. The topic is relatively simple, so it does not need to be extensive or long.
9. References
College Board. (2025). AP Computer Science A course and exam description [Effective fall 2025]. https://apcentral.collegeboard.org/media/pdf/ap-computer-science-a-course-and-exam-description-effective-fall-2025.pdf
Gosling, J., Joy, B., Steele, G., Bracha, G., Buckley, A., Smith, D., & Bierman, G. (2025). The Java language specification: Java SE 25 edition (Secs. 8.4.2, 8.4.9). Oracle. https://docs.oracle.com/javase/specs/jls/se25/html/jls-8.html#jls-8.4.2
Submit Assignment
Need to update a submission later? Open the submissions dashboard.