AP CSA — 1.9 Method Signatures

A method signature is the part of a method header that uniquely identifies which method is meant. Think of it as the method’s “ID badge.”

What a Method Signature Includes (in Java)

Example

public int add(int x, int y)

The method signature is: add(int, int)

Not part of the signature: return type (int, void, …) and access modifiers (public, private).

Why Signatures Matter: Overloading

Java uses the signature to decide which method to call. If two methods share a name but differ in their parameter lists, that is method overloading.

// Overloaded: different parameter lists
public int findArea(int side)                 // square
public int findArea(int length, int width)    // rectangle

These have the same name (findArea) but different signatures:

If two methods have the exact same signature, Java raises a compile-time error—there’d be no way to tell them apart.

Signature Checklist

Part of HeaderIn Signature?
Method nameYes
Parameter types & orderYes
Return typeNo
Access modifier (public/private)No

How AP CSA May Test This

Recognition

Identify whether two methods have the same or different signatures.

Overloading Validity

Decide if a set of methods correctly overloads (different parameter lists).

Call Resolution

Predict which overloaded method is called for a given invocation.

Common Traps
  • Changing only the return type ≠ new signature
  • Changing only parameter names ≠ new signature
  • Autoboxing/varargs ambiguities