Implements in AP Computer Science A

In AP Computer Science A, implements is the Java keyword used in a class declaration to state that the class will provide working code for every method an interface promises, as in public class StepTracker implements FitnessTracker.

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

What is implements?

implements is a Java keyword that shows up in a class header, right after the class name. When you write public class StringCheckerImpl implements StringChecker, you're signing a contract. The interface lists method headers with no bodies, and your class promises to write a real, working version of every single one of them. If you skip even one required method, the code won't compile.

Think of an interface as a job description and implements as accepting the job. The interface says "anyone who takes this role must be able to do isValid(String str)." Your class accepts by putting implements StringChecker in its declaration, then actually writing the method body. This connects directly to how a class is structured in Topic 3.3 (Anatomy of a Class), because implementing an interface shapes which public methods your class must expose.

Why implements matters in AP® Computer Science A

This term lives in Unit 3: Class Creation, Topic 3.3 (Anatomy of a Class), supporting learning objective AP Comp Sci A 3.3.A, which asks you to develop code that designates access and visibility for classes, data, constructors, and methods. The implements keyword sits in the same class header where you make those visibility decisions, and the methods you write to satisfy an interface are always public, since outside code needs to call them. It also reinforces encapsulation (EK 3.3.A.1). The interface defines what a class can do publicly, while the class keeps how it does it private. That split between public contract and hidden implementation is the core idea of data encapsulation, and implements is the keyword that makes the contract official.

How implements connects across the course

Behavior (Unit 3)

An interface is basically a list of required behaviors with no instructions attached. When a class uses implements, it commits to coding those behaviors as actual methods. So implements is the bridge between a promised behavior and the code that performs it.

Attribute (Unit 3)

Interfaces only specify methods, never instance variables. The class that implements the interface gets to choose its own private attributes to make those methods work. Two classes can implement the same interface with totally different data inside.

Object Composition (Unit 3)

Both are class design tools, but they answer different questions. Composition is about what a class has (an object stored as an instance variable), while implements is about what a class promises to do. Strong FRQ class designs often use both at once.

Access Modifiers and Encapsulation (Unit 3)

Methods required by an interface must be public, because the whole point is that outside code can rely on them. Everything else, like the instance variables backing those methods, stays private. implements forces you to think about which side of the public/private line each member belongs on.

Is implements on the AP® Computer Science A exam?

The classic move is a class-design FRQ that hands you an interface and asks you to write a complete class that implements it. The 2017 FRQ Q2 gave a StudyPractice interface with a getProblem() method and asked for a full implementing class. The 2018 FRQ Q3 did the same with a StringChecker interface and its isValid(String str) method. To earn those points you have to write the class header with the implements keyword, declare private instance variables, write a public constructor, and provide a public method body for every method the interface lists. Multiple-choice questions tend to test whether you know a class fails to compile when it implements an interface but leaves a required method unwritten, or whether you can spot the correct class header from several options.

Implements vs extends

Both keywords appear in a class header, but they do different jobs. extends creates an inheritance relationship with another class, so the subclass automatically receives working methods and can override them. implements creates a contract with an interface, so the class receives nothing pre-built and must write every required method itself. Quick check for your class header. Inheriting code that already works? That's extends. Promising to write code that doesn't exist yet? That's implements.

Key things to remember about implements

  • implements goes in the class declaration, right after the class name, like public class StepTracker implements FitnessTracker.

  • A class that implements an interface must provide a public method body for every method header the interface declares, or the code won't compile.

  • An interface only specifies methods, so the implementing class chooses its own private instance variables to make those methods work.

  • implements is for interfaces and extends is for class inheritance; they are not interchangeable.

  • Released FRQs like 2017 Q2 (StudyPractice) and 2018 Q3 (StringChecker) asked for a complete class implementing a given interface, including the header, private data, constructor, and required methods.

Frequently asked questions about implements

What does implements mean in Java for AP CSA?

It's the keyword in a class declaration that says the class will provide working code for every method an interface declares. For example, public class StringCheckerImpl implements StringChecker promises a real isValid method.

Is implements the same as extends in Java?

No. extends sets up inheritance from another class, where you receive methods that already work. implements sets up a contract with an interface, where you must write every required method yourself.

Do I have to write every method in the interface?

Yes. If your class header says implements but the class is missing even one required method, the code does not compile. That's a classic multiple-choice trap.

Can a class implement more than one interface?

Yes. The original keyword definition says one or more interfaces, separated by commas in the header. On the AP exam, though, you'll almost always work with a single interface at a time, like StudyPractice or StringChecker on past FRQs.

Does an interface give my class any instance variables?

No. Interfaces only list method headers. Your implementing class declares its own private instance variables, which keeps the implementation details hidden, exactly the encapsulation idea from EK 3.3.A.1.