AP Computer Science A Unit 3, Class Creation, covers constructors, methods, and user-defined classes across 9 topics and makes up 10-18% of the AP exam. You'll write your own Java classes from scratch, defining instance variables, constructors, and methods to model real-world objects. AP CSA Unit 3 also gets into scope, access modifiers, class variables, and the `this` keyword.
AP Computer Science A Unit 3 is where you stop just using Java classes and start writing your own. The biggest idea is abstraction, meaning you design a class that bundles an object's attributes (instance variables) and behaviors (methods) while hiding the messy internal details from the rest of the program. You'll write constructors, tell instance members apart from static ones, control access with public and private, and trace what happens when object references get passed into and out of methods. This unit makes up 10-18% of the AP exam.
Student, a BankAccount) from how it's actually stored. You give the data a name without exposing its internal representation.deposit(50), you don't need to see the code that updates the balance.private restricts access to the declaring class, while public allows access from outside it.public and instance variables are declared private. Method visibility depends on whether outside code needs to call it.BankAccount "has a" balance, a Student "has a" name. That has-a relationship is exactly what instance variables model.void before the method name.void would go. The return expression is evaluated and its value is sent back, which is called return by value.return keyword also hands the flow of control back to wherever the method was called, so any code after a return on that path never runs.static) belong to the class itself. All objects share a single copy, and public class variables are accessed with the class name and the dot operator, like Math.PI.static) cannot access instance variables or call instance methods unless an object is passed in as a parameter. They can freely use class variables and call other class methods.final cannot have its value modified after it's set.public or private.this.name = name shows up in constructors.this holds a reference to the current object, the one whose method is running. You can use this to disambiguate shadowed variables or to pass the current object as an argument. Class methods have no this reference because they don't belong to any object.| Topic | Big idea | Key syntax or term | Watch out for |
|---|---|---|---|
| Abstraction and program design | Hide details, expose the main idea | Data vs. procedural abstraction | Design comes before code, in diagrams or plain language |
| Impact of program design | Programs affect society, economy, culture | System reliability | Benefits and harms can both be unintended |
| Anatomy of a class | Encapsulation controls what outsiders can touch | public, private | Instance variables are always private in this course |
| Constructors | Set the initial state of every instance variable | public ClassName(params) | No return type, not even void |
| Writing methods | Define behaviors; return at most one value | void vs. return type, return | Code after a return on that path never runs |
| Passing object references | Parameters copy the reference, not the object | Mutable objects, aliasing | Two references can point at the same object |
| Class variables and methods | One shared copy per class, not per object | static, final | Static methods can't touch instance variables directly |
| Scope and access | Variables live only where they're declared | Local variables, shadowing | Parameters are local variables too |
| The this keyword | A reference to the current object | this.x, passing this | Static methods have no this |
This unit is the turning point of the whole course. Units 1 and 2 had you calling methods someone else wrote; from here on, you're the one designing the classes. Object-oriented design (modeling real-world entities as objects with state and behavior) is the central idea of AP CSA, and this unit is where it actually clicks.
String (Unit 1) now flips perspective. You're writing the classes that other code calls, so you finally see what's behind methods like substring and equals.withdraw is just an if statement wrapped in a method header, and FRQs expect you to combine both fluently.Student objects and calling their methods only makes sense once you can build the Student class yourself.public class ClassName { ... } declares a class; in this course, classes are always public.private int count; declares a private instance variable; one copy per object, defining the object's state.public ClassName(int c) { count = c; } is a constructor; it has no return type and initializes every instance variable.public void reset() { ... } is a void method header; it performs an action and returns nothing.public int getCount() { return count; } is a non-void method; the return type replaces void and exactly one value comes back.return expression; evaluates the expression, sends the value back, and immediately exits the method.private static int total; declares a class variable; one shared copy for the whole class, accessed with the class name.public static final double TAX_RATE = 0.07; combines static and final for a class constant that can never change.this.name = name; assigns a parameter to the instance variable it shadows; this always refers to the current object.This unit accounts for 10-18% of the AP exam. On the multiple-choice section, expect code-tracing questions where you determine an object's state after constructor and method calls, predict what a method returns, and reason about what happens when a mutable object is passed as a parameter (aliasing questions are a classic trap). You'll also get questions on scope, shadowing, and whether a static method can legally access an instance variable.
On the free-response section, this unit is the backbone of the class design question. You'll be given a specification in plain language and asked to write a complete class, including the header, private instance variables, a constructor that initializes all of them, and methods with correct return types. Points come from precision, so declaring instance variables private, matching method signatures exactly, and returning the right type all matter. This unit's skills also bleed into the other FRQs, since every method you write anywhere on the exam lives inside a class.
static variable with one copy shared by all objects of the class.void, and writing public void BankAccount() creates a useless method instead of a constructor.this or touch instance variables directly. If a static method needs an object's data, the object has to be passed in as a parameter.return statement ends the method immediately. An if-else where both branches return means anything written after the if-else is unreachable, a detail multiple-choice questions love to test.