Method Call in AP Computer Science A
In AP Computer Science A, a method call is the statement or expression that runs a method by writing its name followed by parentheses containing arguments that match the method signature in number, order, and type. A non-void call's return value must be stored or used in an expression.
What is the Method Call?
A method is a named block of code that sits there doing nothing until you call it (EK 1.9.A.1). The method call is the moment you say "run this now." You write the method's name, then parentheses, then any arguments inside those parentheses, like frog.hopDistance() or Math.max(a, b).
The call has to match the method's signature, which is the method name plus the ordered list of parameter types. Your arguments must line up with the parameter list in number, order, and type (EK 1.9.B.3). The return type then decides how you use the call. A void method returns nothing, so you call it as its own statement and never inside an expression (EK 1.9.B.1). A non-void method hands back a value, so you store it in a variable or use it in an expression. Otherwise that value just disappears (EK 1.9.B.2). The big idea underneath all this is procedural abstraction. You can call a method correctly by knowing what it does from its documentation, even if you never see how it was written.
Why the Method Call matters in AP® Computer Science A
Method calls first show up in Unit 1: Using Objects and Methods (Topic 1.9). That's where AP CSA 1.9.A asks you to identify the correct method to call from documentation and method signatures, and AP CSA 1.9.B asks you to describe how to call methods, void and non-void. The idea comes back in Unit 3: Class Creation (Topic 3.9). There, AP CSA 3.9.A covers the this keyword, which refers to the object whose method is currently being called and can be passed as an argument in a method call. You honestly can't write or trace any Java on the exam without method calls. Every FRQ expects you to call methods you're given, and many MCQs are just "which call compiles?" or "what does this call return?"
Keep studying AP® Computer Science A Unit 3
How the Method Call connects across the course
Arguments and Parameters (Unit 1)
Parameters are the empty slots in the method header, and arguments are the actual values you drop into those slots when you make the call. A method call is basically a matching game. If your arguments don't line up with the parameter list in number, order, and type, the call won't compile.
Return Values and Void Methods (Unit 1)
The return type tells you what a call turns into. A non-void call like calculate(3, 4) acts like a value you can store, print, or compare. A void call like display("hi") is an action, so it stands alone as its own statement.
The this Keyword (Unit 3)
Every instance method call happens on some object, and inside that method, this is the name for that object. That's why you can pass this as an argument to hand the current object to another method. It also explains why static (class) methods have no this, since no object is being called on.
Writing Methods That Call Helper Methods (Units 1 and 3)
FRQs often give you a working helper method and ask you to build a bigger method that calls it. In 2018 FRQ Q1, for example, the frog simulation provides a hop method for you to use instead of rewriting it. That's procedural abstraction in action. Trust the documentation, make the call, and use what comes back.
Is the Method Call on the AP® Computer Science A exam?
MCQs usually test method calls in two ways. First, you get a class or some documentation with several method signatures, often overloaded ones like multiply(int, int) and multiply(double, double). Then you pick which call compiles or which version actually runs, based on the argument types. Second, you trace code and figure out what a call returns or prints. Watch for classic traps. One is a void method used inside an expression. Another is a non-void call whose return value gets thrown away. A third is arguments passed in the wrong order, or an index argument that's off by one, as in documentation for a substring method where endIndex is exclusive.
FRQs depend on method calls everywhere. Released questions like 2018 Q1 (the frog simulation), 2018 Q3 (the StringChecker interface and its isValid method), 2018 Q4 (ArrayTester), and 2019 Q1 (APCalendar) all give you methods with documented behavior. You're expected to call them correctly instead of reimplementing them. Graders reward calling a provided method on the right object, with the right arguments, and actually using the returned value.
The Method Call vs Method Declaration (Method Header)
The declaration defines a method. It lists the return type, the name, and the parameter types, like public int calculate(int x, int y). The call uses the method. It gives only the name and actual argument values, with no types, like calculate(3, 4). A common mistake is writing types inside a call, as in calculate(int 3, int 4), which won't compile.
Key things to remember about the Method Call
A method call runs a method by writing its name followed by parentheses that contain any required arguments.
The arguments in a call must match the method's parameter list in number, order, and compatible type, or the code will not compile.
A void method call is written as its own statement and cannot be used as part of an expression.
The value returned by a non-void method call must be stored in a variable or used in an expression, or it is lost.
When methods are overloaded, Java chooses which one to run by matching the argument types in the call to each method signature.
Inside an instance method, the keyword this refers to the object the method was called on, and static methods have no this reference.
Frequently asked questions about the Method Call
What is a method call in AP Computer Science A?
A method call is code that runs a method, written as the method name followed by parentheses holding any arguments, like obj.display("hi"). The arguments must match the method signature, and the AP CED covers this in Topic 1.9.
Can you use a void method call inside an expression?
No. A void method returns no value, so something like int x = display("hi"); or System.out.println(display("hi")); won't compile. Call a void method as a standalone statement instead.
What's the difference between an argument and a parameter in a method call?
A parameter is the variable declared in the method header, like int x in calculate(int x, int y). An argument is the actual value you pass when you call it, like the 3 in calculate(3, 4). Parameters live in the declaration, and arguments live in the call.
How does Java know which overloaded method to call?
Java matches the number, order, and types of your arguments to each method signature. If a class has both multiply(int, int) and multiply(double, double), then multiply(2, 3) runs the int version and multiply(2.0, 3.0) runs the double version.
Do you have to use the return value of a method call?
Java will compile the code if you ignore it, but per EK 1.9.B.2 you must store the value in a variable or use it in an expression to actually do anything with it. On FRQs, calling a helper method and then ignoring its result is a common way to lose points.
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.