Parameter

In AP Computer Science A, a parameter is a variable declared in a method's header that receives a value (the argument) when the method is called, letting you pass data into methods and constructors so they can do their work.

Verified for the 2027 AP Computer Science A examLast updated June 2026

What is the Parameter?

A parameter is a variable that lives in a method's declaration. When you write public Rectangle(int l, int w), the variables l and w are parameters. They're empty slots waiting for values. When someone calls new Rectangle(5, 3), the values 5 and 3 get copied into those slots, and the method body can use them like any other local variable.

Think of a parameter as the labeled mailbox and the argument as the letter that gets delivered to it. The parameter is part of the method's definition; the argument is the actual value supplied at the call site. One critical Java detail: Java is pass-by-value. The method gets a copy of what you pass in. For primitives like int and double, changing the parameter inside the method never changes the caller's variable. For objects and arrays, the copy is a copy of the reference, so the method can still modify the object the reference points to. That distinction shows up constantly on the exam.

Why the Parameter matters in AP Computer Science A

Parameters are everywhere in AP CSA. You can't call methods on objects (Unit 2), write your own classes and constructors (Unit 5), or pass arrays into methods (Unit 6) without understanding them. The exam expects you to read a method header, figure out what types and how many values it needs, and write calls that match. It also expects you to write your own headers on the FRQs, where every constructor and method you implement starts with a correctly declared parameter list. If your parameter types or order don't match the spec, the rest of your code can't earn full credit. Parameters are also the backbone of method overloading, since Java tells overloaded methods apart entirely by their parameter lists.

How the Parameter connects across the course

Argument (Unit 2)

Arguments and parameters are two sides of the same handoff. The parameter is the variable in the method declaration; the argument is the actual value you pass when you call it. In myAccount.deposit(50.0), 50.0 is the argument that gets copied into the method's parameter.

Method header (Unit 5)

The parameter list is literally part of the method header, along with the access modifier, return type, and name. When an FRQ gives you a header like public static void removeOutliers(int[] data, int min, int max), the parameters tell you exactly what information your code has to work with.

Method Overloading (Unit 5)

Java lets you write multiple methods with the same name as long as their parameter lists differ in type, number, or order. The compiler picks which version to run by matching the arguments you pass to a parameter list. Overloading is impossible to understand without parameters.

Return Type (Unit 2)

Parameters and return values are the input and output of a method. Data flows in through parameters and flows back out through the return statement. A non-void method with parameters takes values in, computes something, and hands a result back to the caller.

Is the Parameter on the AP Computer Science A exam?

Multiple-choice questions love to test whether you can match a method call to its declaration. You'll see stems like "which of the following methods would compile" where the right answer hinges on parameter types and order, or questions asking you to describe a non-void method with parameters. The pass-by-value trap is a classic too. A question may pass an int into a method, modify it inside, and ask what the caller's variable is afterward (unchanged). Compare that to passing an array, like the removeOutliers(int[] data, int min, int max) setup, where changes to the array elements do persist because the parameter holds a copy of the reference.

On FRQs, you write methods to a given specification almost every year. The 2017 FRQs (Digits, StudyPractice, Phrase) and 2018's WordPair all required implementing constructors and methods whose parameters you had to declare and use correctly. A constructor like public WordPair(String first, String second) is just parameters feeding values into instance variables. Get the parameter list wrong and the graders can't give you the method.

The Parameter vs Argument

A parameter is the variable in the method declaration; an argument is the actual value passed when the method is called. In public void deposit(double amount), amount is the parameter. In the call account.deposit(100.0), the value 100.0 is the argument. Teachers and the exam sometimes use the terms loosely, but the distinction matters when you're asked about declarations versus calls. A quick memory hook is that parameters appear in the definition and arguments appear in the call.

Key things to remember about the Parameter

  • A parameter is a variable declared in a method or constructor header that receives a value when the method is called.

  • The parameter is in the declaration and the argument is in the call; the argument's value gets copied into the parameter.

  • Java is pass-by-value, so reassigning a primitive parameter inside a method never changes the caller's original variable.

  • When you pass an object or array, the parameter gets a copy of the reference, so the method can still modify the object's contents (like zeroing out elements of an int[]).

  • Arguments must match the parameter list in number, order, and compatible type, or the code won't compile.

  • Overloaded methods share a name but must have different parameter lists, which is how Java decides which version to run.

Frequently asked questions about the Parameter

What is a parameter in AP Computer Science A?

A parameter is a variable defined in a method's header that receives an input value when the method is called. In public Rectangle(int l, int w), both l and w are parameters that get filled in by whatever values the caller passes.

What's the difference between a parameter and an argument?

The parameter is the variable in the method declaration; the argument is the actual value supplied at the call. In account.deposit(100.0), the literal 100.0 is the argument, and it gets copied into the method's double amount parameter.

If I change a parameter inside a method, does the original variable change?

For primitives, no. Java passes a copy of the value, so reassigning the parameter leaves the caller's variable untouched. For objects and arrays, the method gets a copy of the reference, so it can change the object's contents (like modifying array elements), and those changes stick.

Can a method have more than one parameter?

Yes, parameters are listed in the header separated by commas, like public BankAccount(double initialBalance, double rate). Every argument in the call must match in number, order, and type, or the code won't compile.

Do parameters show up on the AP CSA FRQs?

Constantly. Released FRQs like 2018's WordPair and 2017's Digits and Phrase all required writing constructors and methods with specific parameter lists. Matching the spec's parameter types and order is a baseline requirement for earning the points.