AP Computer Science A
A first-year college course in programming in Java organized by the four units of the College Board's AP Computer Science A course: using objects and methods, selection and iteration, class creation, and data collections. It uses the free Think Java text, a free Java editor and the free past free-response questions on AP Central, and the student writes a program every week. It prepares a student for the AP Computer Science A exam. The student must register for the exam through a school or an approved testing site, and whether a score earns college credit or placement is each college's decision.
- Unit 1: Using Objects and Methods · weeks 1 to 6
- Unit 2: Selection and Iteration · weeks 7 to 14
- Unit 3: Class Creation · weeks 15 to 20
- Unit 4: Data Collections · weeks 21 to 32
- Exam skills and practice exam · weeks 33 to 36
Free texts
- AP Computer Science A course page, College Board. The official four units with each unit's share of the exam score and the exam date; also notes that the Java Quick Reference is provided in the testing app. Free to read; College Board materials, not reusable. (checked 2026-11-09)
- AP Computer Science A past exam questions, College Board AP Central. Free-response questions with scoring guidelines posted for 2023 to 2026, used for practice and grading from week 10. Free to read. (checked 2026-11-09)
- Think Java: How to Think Like a Computer Scientist, 2nd edition, Allen B. Downey and Chris Mayfield. The main text, 17 chapters from variables to inheritance, free to read online. The publisher page lists the book as Creative Commons Attribution-NonCommercial-ShareAlike 4.0; the online edition's own license page was not found, so check before copying. (checked 2026-11-09)
- Think Java, 2nd edition (publisher page), Green Tea Press. The free PDF download of the same book and its license statement (CC BY-NC-SA 4.0). (checked 2026-11-09)
- Introduction to Programming in Java booksite, Robert Sedgewick and Kevin Wayne, Princeton University. Free lecture videos, code and exercises on elements of programming, functions, object-oriented programming and data structures. The pages are free; the site names no open license, so link to it rather than copying it. (checked 2026-11-09)
Study it week by week
Unit 1: Using Objects and Methods (weeks 1 to 6)
Week 1: What programming is
Learn
- What programming is
- Setting up a free Java editor
- Compiling and running
- Output with println
Do
- Think Java, 2nd edition, chapter 1 (Computer Programming): write, compile and run Hello World; read the College Board course page for the four units and the exam date.
- Write a program that prints a four-line poem and one that deliberately has a syntax error, then fix it from the compiler message.
- Start a program journal: one entry per program with what it does and what went wrong.
Week 2: Variables and types
Learn
- Variables and types
- int, double and boolean
- Assignment and arithmetic
- Integer division and remainder
Do
- Think Java, 2nd edition, chapter 2 (Variables and Operators).
- Write programs for a tip calculator and a temperature converter; test with five inputs each.
- Predict the result of ten arithmetic expressions with / and % on paper, then run them.
Week 3: Casting and rounding
Learn
- Casting and rounding
- Compound assignment
- Constants and naming
- Math class methods
Do
- Think Java, 2nd edition, chapter 2 review and chapter 3 (Input and Output), the Math class section.
- Introduction to Programming in Java booksite (Princeton), chapter 1 (Elements of Programming): read the section on data types and do two of its exercises.
- Write a program using Math.pow, Math.sqrt and Math.random to roll a die and find a hypotenuse.
Week 4: Objects and classes
Learn
- Objects and classes
- Creating objects with constructors
- Calling methods
- Strings as objects
Do
- Think Java, 2nd edition, chapter 3 and the String parts of chapter 6.
- Use length, substring, indexOf, equals and compareTo on three strings and print the results; predict each first.
- Write a program that takes a full name and prints the initials and the name reversed (last, first).
Week 5: Writing methods that return values
Learn
- Writing methods that return values
- Parameters
- Static methods
- Calling a method from another
Do
- Think Java, 2nd edition, chapter 4 (Methods and Testing).
- Write five static methods (area of a circle, is even, max of three, count vowels, percent) and a main method that tests each with its expected output.
- Trace by hand what each parameter and local variable holds during one call.
Week 6: Wrapper classes and the Scanner
Learn
- Wrapper classes and the Scanner
- Input from the user
- Documentation and the Java Quick Reference
- Unit 1 review
Do
- Think Java, 2nd edition, chapter 3, Scanner and chapter 4 review; read the Java library methods the College Board lists on the course page.
- Write a program that reads a name and two numbers and prints a result; handle one bad input with a message.
- Self-test: ten multiple-choice questions from a free source you have opened on Unit 1, corrected with the answers.
Unit 2: Selection and Iteration (weeks 7 to 14)
Week 7: Boolean expressions
Learn
- Boolean expressions
- Relational operators
- if and else
- Nested if statements
Do
- Think Java, 2nd edition, chapter 5 (Conditionals and Logic).
- Write a grade-to-letter program and a leap-year program; test the boundary values 59, 60, 89, 90.
- Draw a flowchart for a three-way decision before coding it.
Week 8: Logical operators and De Morgan's laws
Learn
- Logical operators and De Morgan's laws
- Short-circuit evaluation
- Comparing strings and objects
- Truth tables
Do
- Think Java, 2nd edition, chapter 5, logical operators.
- Make truth tables for five Boolean expressions and use De Morgan's laws to rewrite two of them; confirm by running them.
- Explain in two sentences why == can fail for strings and what to use instead.
Week 9: while loops
Learn
- while loops
- Loop control and sentinel values
- Infinite loops
- Tracing loops
Do
- Think Java, 2nd edition, chapter 6 (Loops and Strings), the while loop sections.
- Write a program that reads numbers until the user types 0 and prints the sum and average.
- Trace three loops with a table of variable values and predict the number of times each body runs.
Week 10: for loops
Learn
- for loops
- Counting patterns
- Accumulators
- Off-by-one errors
Do
- Think Java, 2nd edition, chapter 6, for loops.
- Introduction to Programming in Java booksite (Princeton), chapter 1, the loops section; do two exercises such as printing a table of powers.
- Write loops that print the numbers 1 to 20, the even numbers, a countdown and the sum of the first 100 integers.
Week 11: Nested loops
Learn
- Nested loops
- Patterns and shapes
- Loop and string algorithms
- Counting and finding
Do
- Think Java, 2nd edition, chapter 6, strings with loops.
- Print a right triangle and a multiplication table with nested loops; write a method that counts the vowels in a string.
- Practice: one free-response style question on loops and strings from the past questions page on AP Central; score it with the posted guidelines.
Week 12: Algorithms with strings
Learn
- Algorithms with strings
- Palindromes and reversing
- Substring searches
- Writing algorithms in steps
Do
- Think Java, 2nd edition, chapter 6 review.
- Write methods for a palindrome check, a word counter, and a method that removes all copies of a letter.
- Write each algorithm first as plain-English steps, then code it.
Week 13: Testing and debugging
Learn
- Testing and debugging
- Test cases and boundaries
- Reading error messages
- Using print statements to debug
Do
- Think Java, 2nd edition, chapter 4, the testing section, and the debugging appendix.
- Take a program with three planted bugs from a classmate or a free source and find each bug with a written test.
- Write a table of test cases (input, expected, actual) for the month-days and tip programs from earlier.
Week 14: Review of Unit 2
Learn
- Review of Unit 2
- Tracing code
- Free-response practice
- Mixed problems
Do
- Self-test: 15 multiple-choice questions on conditions and loops from a free source you have opened, corrected with answers.
- Practice: one past free-response question from AP Central, written by hand, scored with the posted guidelines.
- Write the five mistakes you made most often so far on a page for later review.
Unit 3: Class Creation (weeks 15 to 20)
Week 15: Classes and objects
Learn
- Classes and objects
- Instance variables
- Constructors
- Encapsulation and private data
Do
- Think Java, 2nd edition, chapter 11 (Designing Classes), and chapter 9 (Immutable Objects) for the idea of fixed objects.
- Write a Student class with private name and grade, a constructor, getters and a toString; make three Student objects and print them.
- Explain in a paragraph why instance variables are private and the methods are public.
Week 16: Accessors and mutators
Learn
- Accessors and mutators
- Methods that change state
- The this keyword
- Method overloading
Do
- Think Java, 2nd edition, chapter 10 (Mutable Objects) and chapter 11.
- Write a BankAccount class with deposit, withdraw and a balance that cannot go below zero; test with six actions.
- Overload a method (for example, a constructor with and without a starting balance) and call each version.
Week 17: Static variables and methods
Learn
- Static variables and methods
- Class versus instance members
- Scope of variables
- Using other classes
Do
- Think Java, 2nd edition, chapter 11, static members.
- Add a static counter that counts how many accounts exist; print it after making four.
- Draw a diagram of memory for three objects and one static variable.
Week 18: Writing programs with several classes
Learn
- Writing programs with several classes
- Methods that call other methods
- Object references
- null and aliasing
Do
- Think Java, 2nd edition, chapter 7 (Arrays and References) for references and chapter 12 (Arrays of Objects), the first part.
- Write a Book and a Library class where Library holds one Book; use methods on both.
- Predict the output of four short programs about two variables referring to the same object, then run them.
Week 19: Designing a class from a description
Learn
- Designing a class from a description
- Choosing data and methods
- Class relationships
- Writing documentation comments
Do
- Think Java, 2nd edition, chapter 11, designing classes; chapter 19 (Javadoc) as a reference.
- Read a written description of a Pet, Car or Recipe class and list its data and methods before coding it.
- Write the class and a main method that tests every method, with comments saying what each does.
Week 20: Inheritance (not on the exam, an optional extension)
Learn
- Inheritance (not on the exam, an optional extension)
- Review of Unit 3
- Class-writing free-response practice
- Unit self-test
Do
- Think Java, 2nd edition, chapter 14 (Extending Classes), read for ideas only; check the Course and Exam Description for what the exam covers before spending time.
- Practice: one past free-response question that asks you to write a class, from AP Central, scored with the posted guidelines.
- Self-test: 15 multiple-choice questions on class design from a free source, corrected with the answers.
Unit 4: Data Collections (weeks 21 to 32)
Week 21: Arrays
Learn
- Arrays
- Creating and indexing arrays
- Traversing with for and for-each
- Array bounds errors
Do
- Think Java, 2nd edition, chapter 7 (Arrays and References).
- Write methods that fill an array of 10 numbers, find the largest, compute the average and reverse it.
- Trace a for loop over an array with a table of index and value.
Week 22: Array algorithms
Learn
- Array algorithms
- Counting, summing, shifting
- Finding minimum and maximum
- Arrays of objects
Do
- Think Java, 2nd edition, chapter 12 (Arrays of Objects) and chapter 13 (Objects of Arrays).
- Write methods that count how many items are above the average, shift items left by one and swap two items.
- Make an array of five Student objects and print the one with the highest grade.
Week 23: ArrayList
Learn
- ArrayList
- add, get, set, remove, size
- Traversing and removing safely
- ArrayList of objects
Do
- Think Java, 2nd edition, chapter 12 and chapter 17 (Advanced Topics), the ArrayList parts.
- Rewrite the to-do list as an ArrayList program with add, remove at index and print; test removal in the middle.
- Explain why removing items in a forward loop can skip an item and show a fix.
Week 24: Arrays versus ArrayLists
Learn
- Arrays versus ArrayLists
- Wrapper classes and autoboxing
- Common ArrayList algorithms
- Consecutive pairs
Do
- Write a method that takes an ArrayList of Integer and removes all negatives, and one that finds the longest run of equal values.
- Make a table: array versus ArrayList, five differences with code for each.
- Practice: one past free-response question on arrays or ArrayLists from AP Central, scored with the posted guidelines.
Week 25: Two-dimensional arrays
Learn
- Two-dimensional arrays
- Row-major traversal
- Rows, columns and diagonals
- Grids in games
Do
- Think Java, 2nd edition, chapter 15 (Arrays of Arrays).
- Write methods that sum each row, sum each column and print a 5 by 5 grid; test on a 3 by 4 grid.
- Write a tic-tac-toe board that checks for a winner in rows, columns and diagonals.
Week 26: 2D array algorithms
Learn
- 2D array algorithms
- Searching a grid
- Neighbors in a grid
- Free-response practice
Do
- Think Java, 2nd edition, chapter 15, review.
- Write a method that counts the neighbors of a cell and use it for one step of a simple life-style grid simulation.
- Practice: one past free-response question on a 2D array from AP Central, scored with the posted guidelines.
Week 27: Reading data from text files
Learn
- Reading data from text files
- File and Scanner
- Parsing lines with split
- Handling bad data
Do
- Think Java, 2nd edition, chapter 3 (Input and Output) and the file input part of chapter 17, and the exam's Java Quick Reference.
- Make a text file of ten names and scores, read it into an ArrayList and print the top score.
- Write a method that skips lines that are blank or have the wrong number of fields and counts them.
Week 28: Searching
Learn
- Searching
- Linear search
- Binary search
- Counting comparisons
Do
- Introduction to Programming in Java booksite (Princeton), chapter 4 (Data Structures), the searching parts; Think Java, 2nd edition, the searching ideas in chapter 13.
- Write linear and binary search on a sorted array and count comparisons for arrays of 10, 100 and 1000 numbers.
- Trace binary search by hand on a list of 15 numbers for a value present and one absent.
Week 29: Selection sort
Learn
- Selection sort
- Insertion sort
- Comparing sorting algorithms
- Merge sort
Do
- Think Java, 2nd edition, chapter 13, selection sort; Introduction to Programming in Java booksite (Princeton), the sorting parts.
- Write selection sort and insertion sort and trace each by hand on [5, 2, 9, 1, 7].
- Use a free sorting visualization to watch each, and write which one moved items the most.
Week 30: Recursion
Learn
- Recursion
- Base case and recursive case
- Tracing recursive calls
- Recursion on strings and arrays
Do
- Think Java, 2nd edition, chapter 8 (Recursive Methods).
- Write recursive methods for factorial, power, sum of digits and reverse a string; draw the call stack for factorial(4).
- Explain what happens if the base case is missing and show it with a safe example.
Week 31: Recursive searching and sorting
Learn
- Recursive searching and sorting
- Merge sort in detail
- Recursion versus loops
- Unit 4 review
Do
- Think Java, 2nd edition, chapter 8 review; Introduction to Programming in Java booksite (Princeton), the recursion and merge sort parts if you need a second explanation.
- Write binary search recursively and trace it on a list of 15 numbers.
- Self-test: 20 multiple-choice questions on data collections from a free source, corrected with the answers.
Week 32: Putting it together
Learn
- Putting it together
- Planning a larger program
- Testing a larger program
- Reflection on design
Do
- Build a small inventory or gradebook program with at least two classes, an ArrayList, a text file and one sorting method; write the plan first.
- Write 10 test cases for it and fix every failure.
- Write a one-page note on how you chose the classes and what you would change.
Exam skills and practice exam (weeks 33 to 36)
Week 33: How the exam is built
Learn
- How the exam is built
- Multiple-choice strategy
- The four free-response types
- Pacing
Do
- Read the exam format in the free Course and Exam Description linked from the College Board site, and the Java Quick Reference.
- Do one full past free-response set under time and score it with the posted scoring guidelines.
- List which of the four free-response question types you find hardest and why.
Week 34: Review of Units 1 and 2
Learn
- Review of Units 1 and 2
- Review of Unit 3
- Tracing practice
- String methods
Do
- Redo the corrected questions from your Unit 1 to 3 self-tests and rewrite any program you got wrong.
- Take a second past free-response set under time and score it.
- Make a one-page sheet of String, Math and ArrayList methods from the Java Quick Reference and test yourself on it.
Week 35: Review of Unit 4
Learn
- Review of Unit 4
- Full practice exam
- Multiple-choice and free-response timing
- Error analysis
Do
- Take a full practice exam from a free source you have opened (a College Board sample, a school-provided AP Classroom set or past free-response questions) in one sitting, with breaks as the exam allows.
- Score it with the posted guidelines and write what you missed by unit.
- Make flashcards for every missed idea and test yourself twice during the week.
Week 36: Final review by unit
Learn
- Final review by unit
- Test-day plan
- Writing code by hand
- Reflection
Do
- Rewrite from scratch, by hand, one method from each unit and trace it on one input.
- Re-take one free-response question without notes and score it.
- Write a one-page reflection on what you now explain well and the one topic to practice next.
Projects
- Week 2: Tip and temperature programs. Two programs with arithmetic, tested with five inputs each and a written test table.
- Week 6: Name and number program. A program that reads input, uses String methods and handles one bad input.
- Week 11: Loop patterns. Triangle and multiplication table programs with nested loops and a short trace.
- Week 13: Debugging a planted-bug program. Find three bugs with written tests and report what each was.
- Week 16: BankAccount class. A class with private data, a constructor, methods and a static counter, tested with six actions.
- Week 19: Class from a description. Design and write a class from a written description with a tester and comments.
- Week 25: Tic-tac-toe grid. A 2D array board that finds winners in rows, columns and diagonals.
- Week 29: Search and sort comparison. Step counts for linear and binary search and two sorts, with a graph.
- Week 32: Inventory or gradebook program. A multi-class program with an ArrayList, a file and a sort, planned, tested and written up.
- Week 35: Full practice exam. A timed practice exam scored with the posted guidelines and an error analysis.
How you will know it
- Programs (about 40 percent): each weekly program is run against the student's test table. A non-expert can type the test inputs and compare the output to the expected column; ask the student to explain one method line by line and to change one behavior.
- Free-response scoring (about 25 percent): use the scoring guidelines posted with the past questions on AP Central; each question is split into parts with a point list, so score each point yes or no and keep the totals by unit.
- Tracing and multiple-choice practice (about 20 percent): 15 to 20 questions per unit from free sources with answers; keep a running score and require written corrections for every miss.
- Code reading aloud (about 10 percent): once a week the student explains a method they did not write, step by step with a table of variable values.
- Practice exam (about 5 percent) in week 35, scored by unit.
Before this course
Familiarity with Algebra 1 concepts and no coding experience, as College Board's course page says. Some teachers also like to see a little prior computing, such as Scratch or a short Python course; that is common advice, not a rule.
Teaching this at home
- Run a week as two days of reading and small programs, two days of a longer program, and one day of tracing or free-response practice. A free editor or an online Java compiler works; the exam is on paper-style questions in an app, so also write and trace code by hand every week.
- Where students get stuck: off-by-one errors in loops, integer division, comparing strings with ==, and the difference between an array, an ArrayList and a 2D array. When code fails, read the first line of the error message together and find the exact line before changing anything.
- Think Java also covers inheritance, graphics and other extras. Check the College Board's Course and Exam Description for exactly what is tested, and skip what is not; this course marks inheritance as an optional extension in week 20 for that reason.
- Free-response questions are graded point by point, and partial credit is common. Teach the student to write something for every part and to match the method name, parameters and return type given in the question exactly.
- Do not copy code from the Internet to finish an assignment; ask for a hint instead. Reading sample solutions after the student has tried is fine and is how most self-taught programmers improve.
- If you fall behind, merge weeks 12 and 13, or weeks 29 and 30. The student must register for the exam through a school or approved testing site; ask early, as deadlines come in the fall.
The official course page is at College Board: https://apstudents.collegeboard.org/courses/ap-computer-science-a
AP is a trademark of College Board, which is not affiliated with Peabody and does not endorse this page.