AP CSA Method Signatures
Method Signatures in AP CSA: Complete Guide (2025-2026)
Method signatures in AP CSA define the contract of a method — its name, parameter list, and return type — and they are tested on every AP Computer Science A exam in Unit 1 (15–25%) and throughout FRQ writing. The AP exam requires you to write syntactically correct method headers, recognize the difference between a parameter (in the definition) and an argument (the value passed when calling), understand what void means, and know when a method must include a return statement. Getting these right is worth multiple FRQ points every year.
📄 Table of Contents
💻 Code Examples — Predict First
Before running each example, write down your prediction. This is the single most effective AP exam study technique.
🤔 Predict the output before running:
public class Main {
// Method signature: name=greet, param=String name, return=String
public static String greet(String name) {
return "Hello, " + name + "!";
}
// void: no return value
public static void printLine(String text, int times) {
for (int i = 0; i < times; i++) {
System.out.println(text);
}
}
public static void main(String[] args) {
String msg = greet("World"); // "World" is the argument
System.out.println(msg);
printLine("---", 3);
}
}
Hello, World! / --- / --- / --- — greet() takes a String parameter and returns a String. printLine() takes two parameters and is void (returns nothing). "World" and "---",3 are arguments (the actual values passed).
🤔 Predict the output before running:
public class Main {
// Overloaded methods: same name, different parameters
public static int add(int a, int b) {
return a + b;
}
public static double add(double a, double b) {
return a + b;
}
public static int add(int a, int b, int c) {
return a + b + c;
}
public static void main(String[] args) {
System.out.println(add(2, 3));
System.out.println(add(2.5, 1.5));
System.out.println(add(1, 2, 3));
}
}
5 / 4.0 / 6 — Three methods named add, each with a different parameter list. Java selects the matching version based on the argument types. This is overloading — same name, different signatures.
🤔 Predict the output before running:
public class Main {
// Parameters are local copies (pass-by-value)
public static void doubleIt(int x) {
x = x * 2;
System.out.println("Inside: " + x);
}
public static void main(String[] args) {
int n = 5;
doubleIt(n);
System.out.println("Outside: " + n);
}
}
Inside: 10 / Outside: 5 — Java passes primitives by value. Inside doubleIt(), x is a copy of n. Changing x does NOT change n. After the method call, n is still 5.
❌ Common Pitfalls
These are the mistakes students most often make on the AP CSA exam with method signatures AP CSA parameters return types. Study them carefully.
Every code path in a non-void method must return a value. Missing a return statement is a compile error. On AP FRQs, forgetting return at the end of a method is the single most common point lost.
public static int square(int n) {
int result = n * n;
// BUG: missing return result;
}
Parameter names in the method definition are local to that method. Arguments are the values passed in at the call site. They don't need to have the same name. Confusing the two leads to scope errors.
public static void print(String msg) { ... } // 'msg' is param
print(greeting); // 'greeting' is the argument
A void method returns nothing. You cannot assign its result to a variable or use it in an expression. Trying to do so is a compile error.
void printX() { System.out.println("X"); }
String s = printX(); // COMPILE ERROR: void has no value
Java passes primitives by value — the method receives a copy. Changes inside the method do NOT affect the original variable. This is one of the most misunderstood concepts in Unit 1.
void addTen(int n) { n += 10; }
int x = 5;
addTen(x);
// x is still 5
On AP FRQs, method headers are worth their own rubric point. The graders check: correct return type, correct method name, correct parameter types and names (in order), and correct access modifiers. Write the header first, then fill in the body.
The AP exam uses the term method signature to mean the method name plus its parameter list (types and order). Return type is NOT part of the signature by formal definition, but the exam also tests return type separately. Know both.
✍ Check for Understanding (8 Questions)
public static int countVowels(String s)
public static double square(double x)
public static int triple(int n) {
int result = n * 3;
}
static void addFive(int x) { x+=5; }
int n=10; addFive(n); System.out.println(n);
I. public static int add(int a, int b)
II. public static double add(int a, int b)
III. public static int add(double a, double b)
public static String repeat(String s, int n)
❓ Frequently Asked Questions
A method signature consists of the method name and its parameter list (types and order). For example, add(int, int) is a signature. Return type and access modifiers are not part of the formal signature, but the AP exam tests all parts of the method header.
A void method performs an action but returns no value. A non-void method computes and returns a value of the declared return type. Every non-void method must have a return statement that returns a value of the correct type.
Overloading means defining multiple methods with the same name but different parameter lists (different types, number, or order). Java selects the correct version based on the argument types at the call site. Return type alone cannot distinguish overloaded methods.
Java passes primitive values by copy. Changes to a parameter inside a method do not affect the original variable in the calling code. The method receives a copy of the value, not a reference to the original variable.
Every non-void method must include at least one return statement that returns a value of the declared return type. Every possible execution path through the method must reach a return statement. Missing a return statement on any path is a compile error.
Tanner Crow — AP CS Teacher & Tutor
11+ years teaching AP Computer Science at Blue Valley North High School (Overland Park, KS). Verified Wyzant tutor with 1,845+ hours, 451+ five-star reviews, and a 5.0 rating. His AP CSA students score 5s at more than double the national rate.
- 54.5% of students score 5 on AP CSA (national avg: 25.5%)
- 1,845+ verified tutoring hours • 5.0 rating
- Free 1-on-1 tutoring inquiry: Wyzant Profile
🔗 Related Topics
Get in Touch
Whether you're a student, parent, or teacher — I'd love to hear from you.
Just want free AP CS resources?
Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.
Message Sent!
Thanks for reaching out. I'll get back to you within 24 hours.
Prefer email? Reach me directly at [email protected]