Static method

In AP Computer Science A, a static method is a method declared with the keyword static that belongs to the class itself rather than to any object, so it can be called as ClassName.methodName() without creating an instance, and it cannot access instance variables or instance methods directly.

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

What is static method?

A static method is a method that lives at the class level instead of the object level. You mark it with the keyword static in the header, like public static int max(int a, int b). To call it, you don't need a new object at all. You just write the class name, a dot, and the method name, the same way you call Math.sqrt(25) or Math.random(). The whole Math class is basically a bag of static methods, which is why you never write new Math().

Here's the intuition. An instance method is a question you ask a specific object ("hey, this bank account, what's your balance?"). A static method is a job the class can do without caring about any particular object ("compute 8% tax on this price"). Because a static method has no this object behind it, it cannot directly access instance variables or call instance methods. It can only use its parameters, local variables, static variables, and other static methods. That restriction is the single most tested fact about static methods on the AP exam.

Why static method matters in AP Computer Science A

Static methods show up the moment you start writing classes in AP CSA, and they're baked into how the exam asks you to write code. Methods like Math.pow and Math.abs that you use constantly are static, so understanding the syntax ClassName.method() explains why those calls work without an object. On the design side, knowing when a method should be static (it doesn't use any of the object's instance data) versus when it must be an instance method (it reads or changes instance variables) is a core class-design skill the CED expects.

It also matters because the College Board loves writing FRQs as static methods. When a problem is really about an algorithm, like processing a 2D array, rather than about an object's state, the FRQ hands you a class full of static methods and asks you to fill them in. If you understand the static rules, you also avoid the classic compile-error question where a static method tries to touch an instance variable.

How static method connects across the course

Instance method (Unit 5)

The direct opposite. An instance method runs on a specific object and can use that object's instance variables through an implicit this. A static method has no object and no this, so it can't. Picking the right one is a design decision the exam tests.

Class variable / static variable (Unit 5)

Static variables are the data side of the same idea. One copy shared by the whole class, like interestRate in a BankAccount class. Static methods CAN access static variables, because both live at the class level rather than inside any one object.

Instance variables (Unit 5)

This pairing is where the trap lives. Instance variables like name and balance belong to individual objects, so a static method referencing them won't compile. There's no object for the variable to belong to when a static method runs.

Constructor (Unit 5)

Constructors exist to create objects; static methods exist to skip objects entirely. A class like Math that's all static methods never needs you to call its constructor, which is why new Math() never appears in your code.

Is static method on the AP Computer Science A exam?

On the multiple-choice section, static methods get tested in a few predictable ways. One stem shows a static method that references an instance variable and asks why it won't compile (a static void updateRecord trying to assign to a private id field is a classic setup). Another asks you to refactor an instance method into a static one, which mostly means adding the static keyword when the method only uses its parameters. A third asks true/false-style questions about what static methods can and can't access.

On the FRQ side, static methods are everywhere as a format. The 2017 Q4 (Successors), 2018 Q4 (ArrayTester), 2019 Q1 (APCalendar), and 2021 Q4 (ArrayResizer) all asked for static methods, usually because the question is about array or algorithm logic rather than object state. You don't get extra points for the word static, but you need to read the given headers correctly, call helper methods without an object (just methodName(args) inside the same class), and never invent instance variables the method can't legally use.

Static method vs Instance method

An instance method belongs to an object and is called through a variable, like myAccount.deposit(50). It can freely read and modify instance variables because there's a specific object (this) attached to the call. A static method belongs to the class, is called like Math.abs(-3), and has no this, so any direct reference to an instance variable or instance method inside it is a compile-time error. Quick test: if the method needs the object's data, it must be an instance method. If it only works with its parameters and static data, it can be static.

Key things to remember about static method

  • A static method belongs to the class, not to objects, so you call it with the class name like Math.sqrt(25) instead of creating an instance first.

  • Static methods cannot directly access instance variables or call instance methods, because there is no object (no this) when a static method runs.

  • Static methods can access static variables and call other static methods, since all of those live at the class level.

  • If a method only uses its parameters and local variables, like calculateTax(price, rate), it can safely be made static.

  • Released FRQs from 2017, 2018, 2019, and 2021 all asked you to write static methods, so expect FRQ headers with the static keyword and call helpers without an object.

  • The most common MCQ trap is a static method that references an instance variable, which is always a compile-time error.

Frequently asked questions about static method

What is a static method in AP Computer Science A?

It's a method declared with the keyword static that belongs to the class itself rather than to any object. You call it as ClassName.methodName(), like Math.random(), without ever using new.

Can a static method access instance variables?

No, and this is the #1 tested fact. A static method has no object behind it, so referencing an instance variable like name or balance inside it causes a compile-time error. It can only use parameters, local variables, static variables, and other static methods.

How is a static method different from an instance method?

An instance method is called on an object (myAccount.deposit(50)) and can use that object's instance variables. A static method is called on the class (Math.abs(-3)) and can't touch instance data. Static answers questions about no object in particular; instance methods answer questions about one specific object.

Do static methods show up on AP CSA FRQs?

Yes, constantly. The 2017, 2018, 2019, and 2021 exams all included FRQs where you write static methods, like ArrayResizer (2021) and APCalendar (2019). The College Board uses static methods when the problem is about algorithm logic, like 2D array processing, instead of object state.

How do I call a static method without an object?

From outside the class, use the class name and a dot: Math.pow(2, 10). From inside the same class (like in an FRQ where one static method calls another), just use the method name directly with its arguments.