DA Dr. Alexander’s Tutoring

Focus your review

AP® Computer Science A

Build confidence reading, explaining, and writing Java. Focus on understanding a program’s state before you reach for the compiler.

Topics to revisit

  • Expressions, types, casting, and method calls
  • Boolean logic, selection, iteration, and tracing
  • Writing methods and designing classes
  • Strings, arrays, ArrayLists, and data-processing algorithms
  • Two-dimensional arrays and the topics specified in your current course framework

Recommended resources

Try it, then explain it

Original practice · Dr. Alexander’s Tutoring

What does this method return for the array {4, -2, 7, 0}? Explain what the variable total represents.

public static int sumPositive(int[] values) {
    int total = 0;
    for (int value : values) {
        if (value > 0) {
            total += value;
        }
    }
    return total;
}
Show explanation

The result is 11. The method adds 4 and 7, skips −2 and 0, and returns their sum. After each iteration, total is the sum of the positive values examined so far. A useful boundary test is an array with no positive values: the result should be 0.

Suggested review activities and the example are original to this site. Match third-party exercises and older released questions to the current course scope.

Bring your questions.

Use these resources to identify what feels unclear, then bring a problem and your attempted solution to a tutoring session.

Ask about tutoring →