Parameter in AP Computer Science A
In AP Computer Science A, a parameter is a variable declared in the header of a method or constructor. It receives the value of an argument when the method is called and can be used inside the method body. Parameter types, in order, form part of the method or constructor signature.
This definition is part of Fiveable's AP Computer Science A review, which also has guided practice questions.
What is Parameter?
A parameter is a variable declared in the header of a method or constructor. It can be used inside that method's body (EK 1.9.A.2). Think of it as a labeled slot that sits empty until someone calls the method. When the call happens, the value passed in (the argument) gets dropped into the slot, and the method works with it.
In public Student(String n, int a), the parameters are n and a. The parameter list gives each one a type and a name. The ordered list of parameter types, together with the method or constructor name, makes up the signature (EK 1.9.A.2, EK 1.13.A.2). Java uses call by value, so a parameter always gets a copy of the argument's value. If the argument is an object reference, the parameter gets a copy of that reference. It points to the same object, not a new copy of it (EK 3.6.A.1).
Why Parameter matters in AP® Computer Science A
Parameters show up across two units. In Unit 1: Using Objects and Methods, you read parameter lists to pick the right method or constructor (AP Comp Sci A 1.9.A, 1.13.A) and to call them correctly (1.9.B, 1.13.C). In Unit 3: Class Creation, you write your own methods and constructors with parameters. Here you also have to reason about what happens when a parameter holds an object reference (3.6.A) and how static methods use parameters to reach instance data (3.7.A). Every FRQ that asks you to write a method or constructor hands you a header full of parameters. Using them correctly is the baseline for earning points.
Keep studying AP® Computer Science A Unit 3
How Parameter connects across the course
Arguments and Method Signatures (Unit 1)
Parameters are the receiving end and arguments are the sending end. The parameter list in the signature sets the rules. Your arguments have to match it in number and order, with compatible types (EK 1.9.B.3). If they don't, the call won't compile.
Constructor Overloading (Unit 1)
A class can have several constructors with the same name, because Java tells them apart by their parameter lists (EK 1.13.A.3). Picture Rectangle(double w, double h) next to Rectangle(double side). Java looks at how many arguments you pass, and of what types, and picks the matching one. Parameters are how overloading works at all.
Object References as Parameters (Units 1, 3)
Call by value means the parameter gets a copy. For an object, that copy is a copy of the address, not of the object. Both variables point to the same object. If the object is mutable, a method can change it through the parameter and the caller will see the change (EK 3.6.A.1). This is exactly why it's good practice not to modify mutable parameters unless the specification asks you to.
Static Methods (Unit 3)
A class method has no object of its own to work with. To read or change instance variables, or to call instance methods, it has to be handed an object through a parameter (EK 3.7.A.1). The parameter is the bridge between the static world and a specific object.
Is Parameter on the AP® Computer Science A exam?
Multiple choice. Parameter questions usually give you a class with overloaded constructors and ask which call is valid, which constructor runs, or what the object's state is afterward. Fiveable practice items built on Student, Rectangle, and BankAccount classes follow this pattern. You compare the arguments in a call against each parameter list and match them by number, order, and type. Other stems trace code where an object reference is passed in and modified, then ask what the caller sees.
Free response. Released FRQs hand you headers and expect you to use the parameters correctly. The 2018 FRQ Q2 WordPair class has a constructor WordPair(String first, String second). The 2017 FRQ Q1 Digits class asks you to build an object from a number passed into its constructor. The 2017 FRQ Q3 Phrase class has methods that take parameters to access and change a stored phrase. On these questions you have to do three things. Use the parameter's value inside the body, store it in an instance variable when the object needs to remember it, and avoid redeclaring the parameter or ignoring it.
Parameter vs Argument
A parameter is the variable written in the method or constructor header, like n in Student(String n, int a). An argument is the actual value you pass when you call it, like "Ana" in new Student("Ana", 16). The parameter is the slot in the definition. The argument is what fills it at call time, and the parameter receives a copy of it.
Key things to remember about Parameter
A parameter is a variable declared in a method or constructor header, and it can only be used inside that method's body.
Arguments passed in a call must match the parameter list in number and order, with compatible types.
A method or constructor signature is its name plus the ordered list of parameter types, which is how Java tells overloaded versions apart.
Java passes arguments by value, so a parameter gets a copy of the argument's value, and for objects that copy is a copy of the reference.
Because a reference parameter points to the same object as the caller's variable, a method can change a mutable object's state through it.
A static method needs an object passed in as a parameter before it can access instance variables or call instance methods.
Frequently asked questions about Parameter
What is a parameter in AP Computer Science A?
A parameter is a variable declared in the header of a method or constructor that receives a value when the method is called (EK 1.9.A.2). In public Rectangle(double w, double h), w and h are parameters.
What's the difference between a parameter and an argument?
The parameter lives in the method definition and the argument lives in the method call. In new Rectangle(3.0, 4.0), the arguments 3.0 and 4.0 get copied into the parameters w and h.
Does changing a parameter change the original variable?
Not for primitives. A parameter holding an int or double is a copy, so reassigning it does nothing to the caller's variable. With an object reference, the parameter points to the same object, so changing that object's state (for example, calling a mutator on it) does affect what the caller sees (EK 3.6.A.1).
Does passing an object as a parameter make a new copy of the object?
No. Java copies the reference, not the object, so both the caller's variable and the parameter refer to the same object (EK 3.6.A.1). This is still call by value, because the value being copied is the reference.
Do parameter names matter for method overloading?
No. Only the number, order, and types of parameters count toward the signature. Rectangle(double w, double h) and Rectangle(double side) are different signatures because one takes two double values and the other takes one, not because of their names.
Keep studying AP Computer Science A
Connect this key term to the AP exam workflow: review the course, practice questions, and check related study tools.
AP Computer Science A hub
Review units, study guides, and course resources.
AP-style practice
Check this vocabulary in multiple-choice context.
FRQ practice
Apply key concepts in written AP responses.
Score calculator
Estimate the exam score you are working toward.
Cheatsheets
Review the highest-yield facts before practice.
Practice exam
Put the full course together before test day.