The AP CSA exam is on Friday May 15, 2026 at 12:00 PM!
Time remaining:
About the Course
- Course Syllabus. Read all about this course, student expectations, and how you will be evaluated.
- AP Computer Science A Description. The official College Board information about this course.
- Code of Honour. All about how to collaborate without plagiarism in this course.
- About the AP Exam. Updated for 2024-25.
- Send me your GitHub username for handin!
- Students get the Java quick reference guide as a cheat sheet on the AP Exam.
Resources
- We are using the textbook Think Java 2nd Edition by Allen Downey and Chris Mayfield. You can download the pdf version, use the online version, or use the interactive version.
- Some additional free text books: CS Awesome (requires free account), Tokyo EdTech's Intro to Java
- Java Style Guide for this course.
Chapter 1. Computer Programming
Ch 1 introduces the fundamentals of computers and programming, covering what a computer is, and basic programming instructions like input, output, mathematical operations, decisions, and repetitions. It presents the "Hello World" program to explain Java classes, methods, statements, and comments. The chapter also distinguishes between high-level and low-level languages, detailing the compilation and interpretation process (javac, java, JVM, byte code). It discusses displaying multiple messages using print vs println, source code formatting, escape sequences, and introduces the broader field of computer science. Finally, it outlines the three types of programming errors: compile-time, run-time, and logic errors, and provides initial debugging advice.
Additional Notes:
- Chapter 1 from "Introduction to Programming Using Java" by David J. Eck is recommended for expanding upon the topic of "What is a computer."
- Notes about Compilers, Interpreters, and Java
- YouTube playlist of my explanation of Compilers, Interpreters, and Java
Chapter 2. Variables and Operators
This chapters delves into variables for storing values (numbers, text) and their declaration and assignment. It introduces memory diagrams to visualise how values are stored and changed. The chapter covers arithmetic operators (+, -, *, /, %) and introduces floating-point numbers (double), discussing rounding errors and string concatenation. It further explains compiler error messages, run-time errors, and logic errors, providing insights into their identification.
Textbook Exercises: Assigned Sept 9th. Use GitHub repository "ch2"
- 2.2: Date.java
- 2.3: Time.java
Chapter 3. Input and Output
This chapters focuses on user interaction, explaining the System class (System.out, System.in) and the Scanner class for reading keyboard input. It details Java's language elements such as packages, classes, methods, statements, expressions, and tokens. The chapter covers literals and constants, formatting output with printf and format specifiers, and how to interpret error messages. It also introduces type cast operators and the remainder (modulo) operator, integrating these concepts into complete programs. We also deal with the "Scanner Bug," which is an annoying problem but easy to avoid if you know about it.
Textbook Exercises: Assigned Sept 11th. Use GitHub Repository "ch3"
- 3.2: Temperature.java
- 3.3: ConvertTime.java
- 3.4: GuessMyNumber.java
Additional Notes
Chapter 4. Methods and Testing
This chapter teaches how to organise programs into multiple methods. It differentiates between void methods (no return value) and value-returning methods, explaining return types and return statements. Concepts such as flow of execution, parameters and arguments, and multiple parameters are introduced. Stack diagrams are presented as a tool to visualise the scope of variables and method execution. The chapter also explores methods in the Math class and the principle of composition, concluding with a discussion on incremental development and the use of stubs and scaffolding for testing.
Textbook Exercises: Assigned Sept 16th. Use GitHub repository "ch4"
- 4.1: FormatDate.java
- 4.2-4.5 Do these on a piece of paper. No need to submit to GitHub
- 4.6: Multadd.java
Chapter 5. Boolean Logic
This chapter introduces relational operators (==, !=, >, <, >=, <=) that produce boolean values (true/false). It covers conditional statements (if-else, if-else-if chains, nesting) for decision-making and the switch statement. The chapter explains logical operators (&&, ||, !), De Morgan's Laws, and the use of boolean variables and methods. A significant focus is placed on validating input and using System.err for error messages.
Supplemental Exercises:
- Practice with Relational Operators. Assigned Sept 22
Coding Bat: Make an account at codingbat.com
- Logic-1: First Column only. Mr. P's Solutions. Assigned Sept 24
- Logic-2: All questions. Mr. P's Solutions. Assigned Sept 25
Textbook Exercises: Assigned Sept 29th. Use GitHub repository "ch5"
- 5.1, 5.4, 5.5: Paper exercises
- 5.2: GuessMyNumber.java
- 5.3: Fermat.java
- 5.6: Quadratic.java
- 5.7: Triangle.java
Additional Notes:
Chapter 6. Loops and Strings
This chapter focuses on repetition using while and for statements, including concepts like loop body, infinite loops, and increment/decrement operators. It discusses nested loops for iterating over multiple variables. The chapter also introduces characters (char, Unicode, escape sequences) and applies loops to strings, covering string length, charAt, indexOf, and substring methods. It concludes with string comparison (equals, compareTo) and String formatting (String.format).
Coding Bat
- String-1: First Column only, My Solutions (Assigned Oct 6)
- String-2: First 4 Rows, My Solutions (Assigned Oct 9)
Supplemental Exercises
- Loops Practice Questions and Answers (Assigned Oct 8)
- String Parsing Practice Questions Use GitHub repository "Ch6". Assigned Oct 14
Additional Notes:
Chapter 7. Arrays and References
Chapter 7 introduces arrays as collections of values of the same type. It explains creating and accessing array elements using the [] operator, including ArrayIndexOutOfBoundsException. The chapter covers displaying and copying arrays (including references and aliasing), and traversing arrays for operations like searching (sequential search), reducing values (sum, product, min/max), and building histograms. It also introduces the enhanced for loop (for-each) and demonstrates character counting using arrays.
Coding Bat
- Array-1: First Column only, Mr. P's Solutions (Assigned Oct 17th)
- Array-2: First Column only, Mr. P's Solutions (Assigned Oct 20th)
Textbook Exercises: Assigned Oct 23rd. Use GitHub repository "ch7" and place all code answers in the same class. Here are Mr. P's solutions.
Extra Practice: Four extra questions with just loops. Assigned Oct 28th
AP Classroom Questions: Progress Check for Loops (Unit 2 MCQ Part B) and Arrays (Unit 4 MCQ Part A). Ignore the first 6 Questions in the Arrays Progress Check for this test.
Data Structure Interlude: ArrayLists
ArrayLists are a dynamic data structure similar to arrays, but they can grow and shrink. ArrayLists can only store objects as opposed to primitive data types; however, Java offers “wrapper classes” that allow primitives to be stored. The unit explores various methods for using ArrayLists including adding, removing, and accessing elements. Additionally, it explains how to traverse ArrayLists, develop algorithms for using ArrayLists, and search and sort them.
- Our notes on ArrayLists
- Here is a great video on the differences between Arrays and ArrayLists.
- PS7A: There are secret levels to CodingBat! Try out The ArrayList secret levels, by doing the "No Loops," "With Loops," and "From other teachers" sections.
- PS7B: See handout in class [Answer Key]
- PS7C