Side-by-Side Comparison
| Feature | Array | ArrayList |
|---|---|---|
| Size | Fixed at creation | Grows and shrinks dynamically |
| Declaration | int[] nums = new int[5]; |
ArrayList |
| Access element | nums[i] |
nums.get(i) |
| Set element | nums[i] = 10; |
nums.set(i, 10); |
| Length / Size |
nums.length (field) |
nums.size() (method) |
| Add element | Not possible (fixed size) | nums.add(10); |
| Remove element | Not possible (fixed size) | nums.remove(i); |
| Primitives | Stores directly (int, double) |
Wrapper classes only (Integer, Double) |
| Default values |
0 for int, null for objects |
Empty (size 0) |
| Enhanced for | Works (read-only) | Works (read-only, no modification) |
| FRQ focus | FRQ 4 (2D arrays) | FRQ 3 (always ArrayList) |
Syntax Comparison: Same Task, Different Code
Traversal
ARRAYint[] data = {10, 20, 30};
for (int i = 0; i < data.length; i++)
{
System.out.println(data[i]);
}
ARRAYLIST
ArrayListdata = new ArrayList (); data.add(10); data.add(20); data.add(30); for (int i = 0; i < data.size(); i++) { System.out.println(data.get(i)); }
Find Maximum
ARRAYint max = vals[0];
for (int i = 1; i < vals.length; i++)
{
if (vals[i] > max)
{
max = vals[i];
}
}
ARRAYLIST
int max = vals.get(0);
for (int i = 1; i < vals.size(); i++)
{
if (vals.get(i) > max)
{
max = vals.get(i);
}
}
[] becomes .get(), and .length becomes .size(). The exam tests whether you can translate between the two.Exam Traps: What College Board Targets
Trap #1
.length vs .size() Mix-Up
Using .size() on an array or .length on an ArrayList causes a compile error. The exam loves this.
Trap #2
Bracket Notation on ArrayList
Writing list[i] instead of list.get(i) is a compile error. ArrayList is not an array — you must use methods.
Trap #3
Primitives in ArrayList
ArrayList does not compile. You must use ArrayList. Java autoboxes between int and Integer, but the declaration must use the wrapper class.
Trap #4
Cannot Resize an Array
Arrays have no add() or remove(). If the exam asks you to add an element to an array, you must create a new larger array and copy elements over. ArrayList handles this automatically.
Know Arrays and ArrayList Inside Out
Get a structured day-by-day study plan that covers both — with practice problems for each.
4-Week Cram Kit — $29.99 Book Tutoring