AP Computer Science A uses Java as its language. The exam tests both conceptual understanding and the ability to read/write code. These notes organize the key programming constructs, OOP principles, and algorithms that appear most frequently on the FRQ.
Units 1–3: Java Basics and Boolean Logic
Primitive types: int, double, boolean. String methods: .length(), .substring(a,b), .indexOf(), .equals(). Integer division truncates (5/2 = 2). Casting: (double) 5/2 = 2.5. Boolean operators: && (AND), || (OR), ! (NOT). De Morgan's law: !(A && B) = !A || !B. Compound conditionals with if/else if/else. For loop, while loop, do-while loop — know when each is appropriate.
Units 4–5: Arrays and ArrayLists
Array declaration: int[] arr = new int[5] — fixed size, indices 0 to length−1. Enhanced for loop: for (int x : arr). ArrayLists: dynamic size, can add/remove elements. ArrayList methods: .add(x), .remove(index), .get(index), .set(index, val), .size(). 2D arrays: int[][] grid = new int[rows][cols]; nested loops traverse rows then columns. Column-major vs. row-major traversal order.
Unit 9: Inheritance and Polymorphism
Encapsulation: private fields, public getters/setters. Inheritance: subclass extends superclass; use super() to call parent constructor, super.method() to call parent method. Polymorphism: a variable of type Animal can hold a Dog object (dynamic dispatch calls Dog's overridden method). Abstract classes cannot be instantiated; interfaces define a contract. instanceof checks type at runtime.
Unit 10: Recursion and Sorting
Recursion requires a base case and a recursive case that moves toward the base case. Trace recursion by substituting values. Binary search: O(log n) — array must be sorted; compare middle element. Sequential/linear search: O(n). Selection sort: O(n²) — find minimum and swap. Insertion sort: O(n²) — build sorted portion left to right. Merge sort: O(n log n) — divide and conquer.
AP CSA Study Guide · AP CSA Flashcards · How to Get a 5 on AP CSA
AP and Advanced Placement are trademarks of College Board. AimFive is not affiliated with or endorsed by College Board.