Method Signature

In AP Computer Science A, a method signature is the combination of a method's name and its parameter types (in order). Java uses the signature, not the return type or access modifier, to tell methods apart, which is what makes method overloading possible.

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

What is Method Signature?

A method signature is the method's name plus the number, types, and order of its parameters. That's it. For public void displayInfo(String name, int age), the signature is displayInfo(String, int). The return type (void), the access modifier (public), and the parameter names are not part of the signature.

Think of the signature as the method's fingerprint. When you call a method, the compiler matches your call against available signatures by name and argument types. That's why a class can have three methods all named process, one taking an int, one taking a String, and one taking both. Same name, different parameter lists, so three different signatures. Java knows exactly which one you mean based on the arguments you pass.

Why Method Signature matters in AP Computer Science A

Method signatures show up the moment you start calling methods on objects in Unit 2 (Using Objects) and become essential when you write your own classes in Unit 5 (Writing Classes). Reading documentation, calling String and Math methods correctly, and writing constructors that match a given specification all come down to matching signatures. The concept also explains method overloading, which is why a class like String can have multiple versions of indexOf or why System.out.print works on an int, a double, or a String. If you can read a signature, you can use any method in the Java Quick Reference without guessing.

How Method Signature connects across the course

Method Overloading (Unit 5)

Overloading is just multiple methods sharing a name but having different signatures. The signature is what makes overloading legal. If two methods had the same name AND the same parameter types, Java couldn't tell them apart and the code wouldn't compile.

Return Type (Units 2 & 5)

The return type sits right next to the signature in a method header, but it's not part of the signature. You cannot overload two methods that differ only in return type, because their signatures would be identical.

Access Modifiers (Unit 5)

Like return type, public and private appear in the method header but aren't part of the signature. They control who can call the method, not which method gets called.

System.out.print (Unit 1)

This is overloading in action from day one. print accepts an int, a double, a String, a boolean, and more because there's a separate print signature for each parameter type.

Is Method Signature on the AP Computer Science A exam?

Method signatures get tested in multiple-choice questions in two main ways. First, you'll see a signature like void updateStatus(boolean isActive, String message) and have to pick the method call that matches it, meaning the right number of arguments, right types, right order. Second, you'll see a class with several overloaded methods (like three versions of process) and have to determine which one a given call invokes, or whether the overloading is even legal. On the free-response section, signatures matter in a quieter but bigger way. FRQs hand you a method header and you must write a method whose signature matches it exactly. Writing processData(String s) when the prompt says processData(int n) costs you points before your logic is even graded. Copy the header exactly as given.

Method Signature vs Method Header

The method header is the full first line: access modifier, return type, name, and parameter list, like public void process(int num). The signature is only the name and parameter types: process(int). This distinction matters because Java distinguishes methods by signature alone. Two methods named process(int) are duplicates even if one returns void and the other returns int, because return type isn't part of the signature.

Key things to remember about Method Signature

  • A method signature is the method's name plus its parameter types in order, like process(int, String).

  • Return type, access modifier, and parameter names are NOT part of the signature.

  • Java picks which method to run by matching the call's arguments to a signature, which is how overloading works.

  • Two methods in the same class can share a name only if their parameter lists differ in number, type, or order.

  • You cannot overload methods by changing only the return type, because the signatures would be identical.

  • On FRQs, match the given method header exactly. A wrong signature can cost points even if your logic is perfect.

Frequently asked questions about Method Signature

What is a method signature in AP Computer Science A?

It's the combination of a method's name and its parameter types in order. For public void displayInfo(String name, int age), the signature is displayInfo(String, int). Java uses signatures to tell methods apart.

Is the return type part of a method signature?

No. The signature is only the method name and parameter types. That's why Java won't let you overload two methods that differ only in return type, because their signatures would be exactly the same.

How is a method signature different from a method header?

The header is the whole first line, including the access modifier and return type, like public void process(int num). The signature strips that down to just process(int). The compiler uses the signature, not the full header, to distinguish methods.

Can two methods in the same class have the same name?

Yes, as long as their parameter lists differ in number, type, or order. That's method overloading. A class can have process(int), process(String), and process(int, String) side by side because each has a unique signature.

How do I match a method call to a signature on the AP exam?

Check three things in the arguments: the count, the types, and the order. For void updateStatus(boolean isActive, String message), a valid call is updateStatus(true, "online"). Swapping the order or passing a String where a boolean belongs won't compile.