AP® Computer Science A glossary
Array
Also called: 1D array, one-dimensional array
Course: AP® Computer Science A Shows up in: Unit 4: Data Collections
An object that stores a fixed number of values of the same type, either primitive values or object references, reached by an index.
Appears in the course and exam description (CED): 4.3.A.14.3.A.24.3.A.34.3.A.44.3.A.5
An array is created with new (every element gets the default value: 0, 0.0, false or null) or with an initializer list. Its length is fixed at creation and read with the length attribute.
int[] goals = {2, 0, 3};
goals[1] = 4;
System.out.println(goals[1] + " of " + goals.length);
Output:
4 of 3 Learn it properly, with a checkpoint 4.3 Array Creation and Access