AP Computer Science A Unit 1, Using Objects and Methods, covers 15 topics worth 15-25% of the AP exam, introducing sorting algorithms, java objects, and the core Java syntax you need to write real programs. You'll work through variables, data types, casting, expressions, and compound assignment operators, then move into object creation, instantiation, and calling instance methods. AP CSA rounds this out with string manipulation via the String class and Math class methods, plus APIs and documentation.
AP CSA Unit 1, Using Objects and Methods, is your introduction to Java, covering how to store data in variables, write arithmetic expressions, and use objects and the methods that come with them. The single biggest idea is that Java code works with two kinds of data, primitive values (int, double, boolean) and object references, and you interact with objects by calling methods on them with the dot operator. Unit 1 makes up 15-25% of the AP exam, the largest weight range of any unit, and everything else in the course is built on top of it.
//, /* */, and Javadoc /** */) document code for humans. The compiler ignores them. Preconditions and postconditions describe what must be true before and after a method runs.int (integers), double (real numbers), and boolean (true or false). A variable is a named storage location whose value can change while the program runs.+, -, *, /, and % (remainder). The rule that decides half the answers in this unit: two ints produce an int, so 7 / 2 is 3, not 3.5. If at least one operand is a double, the result is a double.(int) truncates the decimal part (it chops, it does not round), while ints widen to doubles automatically. To round a non-negative double, use (int)(x + 0.5); for negatives, (int)(x - 0.5).Integer.MAX_VALUE and bottom out at Integer.MIN_VALUE. Going past either causes overflow. Doubles have limited precision too, which causes round-off errors.+=, -=, *=, /=, %=) do the operation and the assignment in one step. x++ and x-- add or subtract 1.System.out.println prints and moves to a new line; System.out.print prints and stays on the same line. Escape sequences \", \\, and \n let you put special characters inside string literals.Car class describes what every car has and does, while myCar is one actual car with its own attribute values.null.new plus a constructor call, like new Car("red", 2024). Constructors share the class's name, and their signature is the name plus the ordered list of parameter types.void method returns nothing, so it stands alone as a statement. A non-void method returns a value you should store in a variable or use inside an expression, otherwise the result vanishes.myCar.getColor()). Calling any method on a null reference throws a NullPointerException.Math.sqrt(25)). The static keyword in the header is the giveaway.java.lang (available by default) and contains only static methods: Math.abs, Math.pow, Math.sqrt, and Math.random(), which returns a double from 0 up to but not including 1.(int)(Math.random() * range) + min gives a random int from min to min + range - 1.substring return a brand new String.length() - 1. Going outside that range throws a StringIndexOutOfBoundsException.length(), substring(from, to) (includes index from, excludes index to), indexOf(str) (returns -1 if not found), equals(other), and compareTo(other). Use equals to compare String contents, never ==.| Topic cluster | Core idea | Must-know detail | Classic gotcha |
|---|---|---|---|
| Program basics (1.1, 1.8) | Algorithms are ordered steps; compilers catch syntax errors | Syntax vs. logic vs. run-time errors | Logic errors compile cleanly |
| Primitives and expressions (1.2-1.4) | int, double, boolean store values; = assigns | int / int gives an int result | 7 / 2 is 3, not 3.5 |
| Casting and limits (1.5) | Convert types; memory limits values | (int) truncates; overflow at Integer.MAX_VALUE | (int) 3.9 is 3, not 4 |
| Compound operators (1.6) | Shorthand for operate-then-assign | +=, -=, *=, /=, %=, ++, -- | x++ adds 1; it's not just decoration |
| Objects and constructors (1.12, 1.13) | Class is the blueprint; object is the instance | new + constructor; match signature by parameter types | Reference holds an address, possibly null |
| Calling methods (1.9, 1.10, 1.14) | Static methods use the class name; instance methods use the object | void vs. return values; argument order matters | Method call on null throws NullPointerException |
| Math class (1.11) | All static, all in java.lang | Math.random() gives [0, 1) | Random range formula: (int)(Math.random()*range)+min |
| Strings (1.15) | Immutable character sequences, indexed from 0 | substring(from, to) excludes index to | Compare with equals, not == |
Unit 1 carries the heaviest exam weight in the course and supplies the vocabulary for every other unit. AP CSA is built around modeling real-world things as objects, and this unit is where you learn what an object is and how to talk to one.
object.method(arguments)) are the muscle memory you need before loops, classes, and ArrayLists make any sense.length(), substring, and indexOf pairs with loops there to process text character by character.int x = 5; double y = 2.5; boolean flag = true; declares and initializes the three primitive types.System.out.println(...) vs. System.out.print(...) prints with or without a trailing newline.% (remainder operator) gives the leftover after integer division; x % 2 == 0 tests for even numbers and x % 10 grabs the last digit.(int) and (double) casts convert between numeric types; (int) truncates toward zero.(int)(x + 0.5) rounds a non-negative double to the nearest integer; use (int)(x - 0.5) for negatives.x += 3; and friends (-=, *=, /=, %=) operate and assign in one statement; x++ and x-- adjust by 1.ClassName var = new ClassName(args); declares a reference variable and instantiates an object with a constructor.objectName.methodName(args) calls an instance method; ClassName.methodName(args) calls a static method.Math.abs(x), Math.pow(base, exp), Math.sqrt(x), Math.random() are the four required Math methods.(int)(Math.random() * range) + min generates a random integer from min through min + range - 1.str.length(), str.substring(from, to), str.substring(from), str.indexOf(other), str.equals(other), str.compareTo(other) are the required String methods; substring(i, i + 1) extracts a single character as a String.Unit 1 is weighted at 15-25% of the exam, the widest and heaviest range in the course. On the multiple-choice section, this content appears mostly as code analysis. You'll determine what a code segment prints, evaluate an arithmetic expression where int division or casting changes the answer, trace what value a variable holds after a series of assignments, or predict the result of String method calls (substring boundaries are a favorite). Expect questions that hand you a class's documentation or method signatures and ask which call is valid, or what a call returns, testing whether you can read an API without seeing the implementation.
On the free-response section, Unit 1 skills are baked into everything. Every FRQ requires you to call methods on objects you're given, pass arguments that match parameter lists, store and use return values, and build Strings or numeric results correctly. The Java Quick Reference provided on the exam lists the required Math and String methods, but you need to know what they do and their exact behavior (like substring excluding the to index) cold, because the reference won't explain the gotchas.
new.+= that performs an operation and stores the result back in the variable in one step.7 / 2 evaluates to 3 because both operands are ints. Write 7 / 2.0 or (double) 7 / 2 to get 3.5. This single rule answers a surprising number of multiple-choice questions.(int) 3.9 is 3, not 4. Casting truncates. Rounding requires the (int)(x + 0.5) pattern.== checks whether two references point to the same object; equals checks whether the contents match. Always use equals to compare String values.substring(2, 5) includes index 2 but excludes index 5, returning 3 characters. And indexOf returns -1 (not an exception) when the substring isn't found.AP CSA Unit 1 covers 15 topics that build the foundation of Java programming: algorithms and compilers, variables and data types, expressions and output, assignment statements and input, casting, compound assignment operators, APIs and libraries, documentation with comments, method signatures, calling class methods, the Math class, objects and instantiation, calling instance methods, and String manipulation. See the full topic list at AP CSA Unit 1.
Unit 1 makes up 15-25% of the AP CSA exam, making it one of the most heavily weighted units. It covers core Java concepts like variables, data types, expressions, object creation, and String and Math class methods. A strong grasp of this unit directly supports your performance across the rest of the exam.
The AP CSA Unit 1 progress check in AP Classroom includes both MCQ and FRQ parts drawn from the unit's 15 topics. MCQ questions test variables, data types, casting, expressions, compound assignment operators, and method signatures. FRQ questions focus on object creation, calling instance methods, and String manipulation. Reviewing those topics before attempting the progress check is the most efficient prep. Practice with aligned questions at AP CSA Unit 1.
AP CSA Unit 1 FRQs typically ask you to write or trace code involving object creation, calling instance methods, and String manipulation. To practice, write short Java programs that instantiate objects, call Math and String class methods, and use variables with correct data types. Check your output against expected results, then review any casting or method signature errors. Find practice FRQs at AP CSA Unit 1.
The best place to find AP CSA Unit 1 practice questions, including multiple-choice and practice test sets, is AP CSA Unit 1. That page has MCQ practice covering variables, data types, expressions, casting, compound assignment operators, APIs, and object instantiation, so you can test each topic before moving on. Mixing MCQ practice with short coding exercises on String and Math methods gives you the most complete prep.
Start with variables and data types, since every other topic in Unit 1 builds on them. Then work through expressions, assignment statements, and casting before moving to method signatures and APIs. Once those feel solid, practice calling Math and String class methods, then move to object creation and calling instance methods. Write small Java programs for each topic rather than just reading. Use the progress check MCQ to spot gaps, and revisit any topic where casting or method calls trip you up. Full topic guides are at AP CSA Unit 1.
