A 1D (one-dimensional) array in AP Computer Science A is a fixed-size data structure that stores elements of a single type in sequential order, where each element is accessed by an integer index starting at 0.
A 1D array is Java's most basic way to store a list of values. You declare it with a type and a size, like int[] scores = new int[10];, and Java gives you 10 slots in a row, each holding an int. Every slot is an element, and every element has an index. Indexes start at 0, so a 10-element array runs from index 0 to index 9. That last part trips up more AP students than anything else in the course.
Two properties define a 1D array. First, the size is fixed. Once you create it, you can't add an 11th slot (that's what ArrayList is for). Second, every element is the same type. An int[] holds only ints, a String[] holds only String references. Think of it as a single row of numbered lockers, all the same shape, where the number on the locker (the index) is how you get to what's inside (the element).
1D arrays anchor the data-structures stretch of AP CSA. They're where you first learn traversal, the pattern of visiting every element with a for loop or enhanced for loop, and that pattern repeats for the rest of the course. ArrayLists are basically resizable arrays with method calls instead of bracket notation. 2D arrays are literally arrays whose elements are 1D arrays. The classic algorithms the exam loves (find the max, sum the elements, count matches, shift or reverse elements, linear search) are all built on 1D array traversal. If you can't traverse a 1D array confidently, every later unit gets harder. If you can, 2D arrays become "do the 1D thing twice."
Index and Element (Unit 6)
These are the two vocabulary words that make arrays work. The index is the position number (starting at 0), and the element is the value stored there. Asking for arr[arr.length] is the classic mistake, because the last valid index is length - 1, and going past it throws an ArrayIndexOutOfBoundsException at runtime.
Traversal (Unit 6)
Traversal means visiting every element, usually with a standard for loop (when you need the index) or an enhanced for loop (when you only need the values). Almost every array MCQ and FRQ is really a traversal question wearing a costume.
2D Arrays (Unit 8)
In Java, a 2D array is an array of 1D arrays. That's why the outer loop of a nested enhanced for loop over a String[][] iterates over String[] rows, not individual Strings. Once that clicks, 2D array code stops looking mysterious.
ArrayList (Unit 7)
ArrayList is the flexible sibling of the 1D array. It grows and shrinks, but you trade bracket syntax for method calls like get(i) and add(x). The exam loves making you translate logic between the two, so know both syntaxes cold.
Modulo Operator (%) (Unit 1)
The % operator pairs naturally with arrays for wrap-around logic. index % arr.length always lands inside the array's bounds, which is how circular traversals and "every nth element" problems work.
Arrays show up everywhere on the AP CSA exam. In the multiple-choice section, expect questions that make you trace a loop over an array, spot off-by-one errors, predict an ArrayIndexOutOfBoundsException, or compare standard versus enhanced for loop behavior (remember, assigning to an enhanced for loop variable does not change the array). On the free-response section, FRQ 3 is dedicated to Array/ArrayList, so you will write code that creates, traverses, and modifies a 1D array or ArrayList. Your 1D array skills also get tested indirectly. Practice questions on 2D arrays constantly check whether you know that the outer loop of a nested enhanced for loop iterates over 1D arrays (the rows), which only makes sense if you understand that a 2D array is built from 1D arrays. Master find-the-max, sum, count, search, and shift on a 1D array and you've covered most of what FRQ 3 can throw at you.
A 1D array has a fixed size set at creation and uses bracket syntax (arr[i], arr.length). An ArrayList resizes automatically and uses methods (list.get(i), list.size(), list.add(x)). Note the parentheses difference too. Arrays use length with no parentheses; ArrayLists use size() with them. Mixing those up is one of the most common syntax errors on FRQs.
A 1D array stores a fixed number of same-type elements in order, and you access each element with an integer index that starts at 0.
The last valid index of an array is arr.length - 1, and accessing any index outside 0 through length minus 1 throws an ArrayIndexOutOfBoundsException.
Use a standard for loop when you need the index or want to modify elements, and an enhanced for loop when you only need to read values.
Changing the loop variable inside an enhanced for loop does not change the array itself, which is a favorite MCQ trap.
A 2D array in Java is just an array of 1D arrays, so everything you learn about 1D traversal applies twice in nested loops.
FRQ 3 on the AP exam targets Array/ArrayList, so practice writing traversal algorithms like sum, max, count, and search by hand.
It's a fixed-size structure that stores elements of one type in sequential order, like int[] nums = new int[5];. Each element is accessed by an index from 0 to length minus 1.
No. Once created, an array's length is fixed forever. If you need a resizable list, use an ArrayList, which grows and shrinks with add and remove calls.
Arrays are fixed-size and use brackets (arr[i], arr.length), while ArrayLists resize automatically and use methods (list.get(i), list.size()). The AP exam tests both syntaxes, especially on FRQ 3.
arr[10] throws an ArrayIndexOutOfBoundsException. Off-by-one errors here are a top source of lost MCQ points.Yes. In Java a String[][] is an array whose elements are String[] arrays. That's why the outer loop of a nested enhanced for loop must use the 1D array type (like String[] row), not the element type.