Welcome to the AP CSA Unit 2 Using Objects Practice Hub. In Unit 1, we covered Java’s basic primitive types. Now, we step into the core of Object-Oriented Programming (OOP). Unit 2 introduces you to reference data types, showing you how to instantiate objects, call methods, and utilize Java’s built-in classes.
According to the College Board, Unit 2 accounts for 5–7.5% of your total exam score. However, object references, string manipulation, and the Math class are heavily embedded in almost every Free Response Question (FRQ), meaning this unit’s true weight is actually much higher.
What You Need to Know for the Exam:
- How to instantiate objects using the
newkeyword and constructors. - The critical difference between primitive types and reference types in memory (including aliasing and
nullpointers). - String immutability and tracing methods like
substring(),indexOf(), andlength(). - How to use static methods from the
Mathclass, specifically generating random numbers withMath.random(). - Wrapper classes (
Integer,Double) and how autoboxing and unboxing work behind the scenes.
⚡ Unit 2 Exam Cheat Sheet
- The Math.random() Formula: To get a random integer from
mintomax(inclusive), use:(int)(Math.random() * ((max - min) + 1)) + min; - String Immutability: Strings cannot be changed once created.
str.toUpperCase();does nothing unless you save it:str = str.toUpperCase(); - Comparing Objects: Never use
==to compare two Strings.==checks if they share the exact same memory address. Use.equals()to check if their text is the same.
Select a specific topic below to launch the interactive practice widget. We recommend completing them in order, finishing with the comprehensive Mock Exam.
substring, indexOf, immutability, and avoid out-of-bounds exceptions.Math.abs, Math.pow, and formulas for Math.random() ranges.new keyword, constructors, null pointers, and aliasing traps.Integer and Double autoboxing rules.AP CSA Unit 2 Frequently Asked Questions
No. You only need to memorize the methods specified in the AP Java Quick Reference Guide:
length(), substring(), indexOf(), equals(), and compareTo().A primitive type (like
int or double) stores the actual data value directly in memory. A reference type (like a String or a custom object) stores a memory address that points to where the actual data is located in the heap.Autoboxing is the automatic conversion the Java compiler makes between primitive types and their corresponding wrapper classes (e.g., converting an
int directly to an Integer object) without requiring the new keyword.Struggling with Object References?
If Unit 2 is slowing you down, don’t wait. Learn how to trace memory and crush your FRQs with personalized 1-on-1 coaching from a Senior Java Engineer.
AP CSA 1-on-1 Tutoring