Method Call

A method call is the statement that actually runs a method, written as the method name followed by parentheses containing any arguments, which must match the method's parameter list in number, order, and type (e.g., obj.displayInfo("Ana", 16);).

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

What is Method Call?

A method call is how you tell Java to execute a method. You write the method's name, then parentheses, and inside the parentheses you pass arguments that line up with the method's parameters. If the method belongs to an object, you call it through that object with dot notation, like frog.simulate(). If it's a static method, you call it through the class name, like Math.sqrt(25).

The call has to match the method signature exactly. That means the right number of arguments, in the right order, with compatible types. Calling display(3.5) works if there's a display(double x) defined, but calling it with a String when no version accepts one is a compile-time error. What you do with the result also depends on the return type. A non-void method hands back a value you can store or use in an expression, while a void method just does its job (like printing) and returns nothing, so its call stands alone as a statement.

Why Method Call matters in AP Computer Science A

Method calls are everywhere in AP CSA. Unit 2 (Using Objects) is built around calling methods on objects and using Math class static methods, and Unit 5 (Writing Classes) flips the perspective so you write the methods that get called. The CED expects you to call instance methods with and without parameters, call non-void methods as part of expressions, and trace what happens when control jumps into a method and comes back. Every FRQ you write depends on this skill, because the graders hand you a class with existing methods and expect you to call them correctly instead of rebuilding their logic from scratch.

How Method Call connects across the course

Method Signature (Units 2 & 5)

The signature is the lock and the call is the key. A call only compiles if its arguments match the signature's parameter list in count, order, and type. This is also how Java picks between overloaded methods like display(int x) and display(double x).

Return Type (Unit 2)

The return type tells you what a method call evaluates to. A call to a method returning boolean can sit inside an if condition, while a call to an int method can be stored in a variable or used in math. Treating a call like a value is the whole point of non-void methods.

Void Method (Unit 2)

Void methods return nothing, so their calls stand alone as statements, like obj.printInfo();. Trying to store a void call in a variable, int x = printInfo();, is a classic MCQ compile-error trap.

Constructors and Object Creation (Unit 2)

Creating an object with new Canvas(5, 5) looks like a method call and behaves like one, since arguments still must match the constructor's parameter list. The difference is that a constructor call always builds and returns a new object.

Is Method Call on the AP Computer Science A exam?

Multiple-choice questions love to show you a method signature and ask which call compiles. Practice questions in this style ask things like which call matches void displayInfo(String name, int age) or which call to overloaded display(int) / display(double) methods causes a compilation error. Your job is to check argument count, order, and type, and watch for void methods being misused as values.

On the free response, method calls are how you earn points efficiently. The 2019 APCalendar FRQ gave you isLeapYear(year) and expected you to call it inside numberOfLeapYears rather than rewrite leap-year logic. The 2018 frog simulation and StringChecker questions worked the same way, handing you methods like isValid(str) to call inside your own code. The rubric rewards correct calls to provided methods, and reimplementing them from scratch wastes time and risks errors.

Method Call vs Method Declaration

A declaration defines the method, including its header (like public void display(int x)) and body, and it runs nothing by itself. A call executes that method, like display(7);. Think of the declaration as writing the recipe and the call as actually cooking. On the exam, a declaration with no call means the code inside never runs.

Key things to remember about Method Call

  • A method call executes a method by writing its name followed by parentheses with any required arguments inside.

  • Arguments in a call must match the method signature's parameters in number, order, and type, or the code won't compile.

  • Calls to non-void methods produce a value you can store or use in an expression, while void method calls stand alone as statements.

  • Instance methods are called on an object with dot notation (obj.method()), while static methods are called through the class name (Math.abs(x)).

  • With overloaded methods, Java picks which version to run based on the argument types in your call.

  • On FRQs, call the provided methods (like isLeapYear or isValid) instead of rewriting their logic; the rubric rewards correct calls.

Frequently asked questions about Method Call

What is a method call in AP Computer Science A?

A method call is the statement that runs a method, written as the method name plus parentheses with any arguments, like frog.simulate() or Math.sqrt(25). The arguments must match the method's parameter list in number, order, and type.

Is a method call the same as a method declaration?

No. The declaration defines what the method does (header plus body), while the call actually executes it. Code inside a method never runs until something calls it.

Can you store the result of a void method call in a variable?

No. Void methods return nothing, so int x = printInfo(); is a compile-time error. Void calls must stand alone as statements, which is a frequent MCQ trap.

How does Java know which overloaded method a call uses?

Java matches the argument types in the call against each signature. With display(int x) and display(double x) defined, display(3) runs the int version and display(3.5) runs the double version, while an argument matching neither (like a String) causes a compilation error.

Do I need to call given methods on AP CSA FRQs?

Yes, and you should. FRQs like 2019's APCalendar expected you to call the provided isLeapYear(year) method inside your solution, and 2018's StringChecker expected calls to isValid(str). Rewriting that logic yourself wastes time and can cost points.