SAT / PSAT
SAT / PSAT Prep
History & Social Science
AP World History AP US History AP European History AP Human Geography AP US Government & Politics AP Psychology AP Macroeconomics AP Microeconomics
English
AP English Language & Composition AP English Literature & Composition
Math & Computer Science
AP Calculus AB/BC AP Precalculus AP Statistics AP Computer Science A AP Computer Science Principles
Sciences
AP Biology AP Chemistry AP Environmental Science AP Physics 1 AP Physics 2
World Languages & Arts
AP Spanish Language AP Art History AP Music Theory Start studying →
Unit 3 · Class Creation Flashcards Cheat Sheet Essentials Visual Review MC Practice FRQ Practice

AP Computer Science A Unit 3 Cheat Sheet

A one-page visual summary of Class Creation — every part of a class, method type, and exam trap you need, on a single screen.

← Back to Unit 3 hub

The basics

What it covers: Abstraction and program design, encapsulation, constructors, instance variables, accessor/mutator methods, parameter passing, static members, scope, and the this keyword.

Exam weight: About 10–18% of the multiple-choice section, and the focus of the Class Design free-response question.

The big question: How do you design and build your own classes in Java?

Computational thinking practices: Design Code, Develop Code, Analyze Code, Document Code, and Use Computers Responsibly.

Key topics at a glance

Anatomy of a Class

A class has instance variables (state), a constructor (initialization), and methods (behavior). In this course classes are public.

Encapsulation

Make instance variables private and expose behavior through public methods, so outside classes can’t change state directly.

Constructors

Same name as the class, no return type. Initializes instance variables. A missing constructor gives a default that sets fields to 0/0.0/false/null.

Accessor vs. Mutator

Accessor (getter): returns a value, changes nothing. Mutator (setter): changes an instance variable, usually returns void.

Parameters & Return

A parameter is named in the header; an argument is passed at the call. Primitives are passed by value (a copy). The return type sets what comes back.

static (Class) Members

static variables/methods belong to the class, shared by all objects (one copy). Call with ClassName.member; static methods can’t use this.

Scope

Local variables live only inside their method/block. Instance variables are visible in all the object’s non-static methods.

this Keyword

Refers to the current object. Use this.field = field; to tell an instance variable apart from a same-named parameter.

The key terms and rules you must know

Key themes to remember

Common exam traps