AP Computer Science A (Java)

AP / IB · Computer Science

AP Computer Science A is a first course in object-oriented programming taught entirely in Java. The work splits into two halves: writing correct Java by hand (no compiler, no autocomplete, on the exam you write methods on paper) and tracing code someone else wrote to predict exactly what it prints or returns. Sessions focus on the subset of Java the course actually tests \u2014the Java Quick Reference set of String, Math, ArrayList, Object and List methods\u2014 rather than the whole language, and on the four free-response formats: methods and control structures, class design, array/ArrayList traversal, and 2D arrays.

Start a session on AP Computer Science A (Java)

What this covers

  • Primitive types vs. reference types: integer division and truncation, casting, double precision, and what a variable actually holds when it refers to an object
  • Class design from a written specification: instance variables, constructors, accessors and mutators, the this keyword, and static vs. instance members
  • Traversal patterns over arrays, ArrayList and 2D arrays \u2014 enhanced for loops, row-major vs. column-major order, and safely removing elements while iterating
  • Inheritance and polymorphism: extends, super, overriding vs. overloading, abstract classes and interfaces, and which method runs when the declared type differs from the actual object
  • Recursion \u2014 tracing recursive calls by hand, identifying base cases, and reading recursive methods that operate on arrays or strings
  • The tested algorithms: sequential and binary search, selection, insertion and merge sort, plus informal reasoning about how many comparisons each performs

Where learners get stuck

Using == to compare Strings or objects instead of .equals()
For int, char and boolean, == works fine, so students generalise it. With reference types == compares memory addresses, and small string literals often get interned so the wrong code appears to work in testing and then fails on the exam.
Confusing the declared (compile-time) type with the actual (run-time) type in an inheritance hierarchy
Questions like Animal a = new Dog(); a.speak(); require holding two ideas at once: the compiler checks the method exists in Animal, but the Dog version actually executes. Students who learned 'a is a Dog' skip the compile-time check and miss the errors that arise when the subclass adds new methods.
Believing that passing an object to a method can't change it, or that it can change which object the caller sees
Java is always pass-by-value, but the value passed for an object is a reference. Students hear 'pass by value' and conclude nothing changes, or hear 'objects are passed by reference' and expect reassignment inside the method to stick. Both errors show up in FRQs that mutate an ArrayList parameter.
Off-by-one errors and shifting indices when removing from an ArrayList inside a loop
Array bounds use < length while ArrayList uses < size(), and calling remove(i) shifts every later element down one, so the loop counter skips an item. The code runs without an exception, which hides the bug.

What a session looks like

Sessions are spoken, one-on-one with an AI tutor. A typical session mixes code tracing done out loud \u2014 you narrate the value of each variable through a loop while the tutor checks each step \u2014 with dictating method bodies line by line, which forces you to name types, brackets and return statements explicitly rather than relying on an IDE. The tutor also poses the multiple-choice style questions where you predict output or spot the compile error, and works backwards from an FRQ prompt to the class structure it implies before any code is written.

Helpful to know first

  • Comfort with Algebra 1: variables, functions, evaluating expressions, and inequality conditions
  • Familiarity with remainders and integer division (the % operator is used constantly)
  • No prior Java is required, though experience in Python or another language helps; students coming from Python usually need the most work on static typing and explicit declarations

Questions

Do I need to know programming before starting AP Computer Science A?
No. The course starts from variables and output statements. Students with Python or JavaScript experience usually move faster through control flow but spend extra time on type declarations, compile-time errors and the object-oriented material, which has no direct Python analogue at this level.
How is AP Computer Science A different from Computer Science Principles?
CS A is a Java programming course assessed on writing and reading real code, with heavy emphasis on classes, arrays and recursion. Principles is broader and language-agnostic, covering data, the internet, and computing impact, with far less code writing. CS A is the harder course for students who dislike syntax detail.
Can voice tutoring actually help with coding?
For this course, yes, because much of the exam is done without a computer. Tracing loops aloud, explaining why a line won't compile, and dictating a method with correct return types are all speaking tasks. You can have your editor open alongside and read code to the tutor.
What's the best way to prepare for the free-response questions?
Practise writing full methods by hand under time pressure, then check them against the specification line by line \u2014 most lost points come from ignoring the given method signature, forgetting a return, or not using the helper methods the question supplies. Sessions can work through this checking process on your own attempts.

Other AP / IB Computer Science topics