Set up a one dimensional table (i.e., one row) with 0 to (size - 1) elements
Upon instantiation of an array object, all elements contain default value for datatype stored in array OR values from the initializer list
Determine access or change of element, or action on entire array object, and update slots as needed (remembering assignment subgoals)
Accessing array element
Evaluate expression within [] which will be the index for element to be accessed
arrayName[index] returns value stored at that index
index must be between 0 and arrayName.length - 1, inclusive otherwise IndexOutOfBounds exception occurs
Changing value of an array element
Evaluate expression within [] which will be the index for element to be accessed
arrayName[index] will now contain the value on the RHS of assignment statement
(remember the assignment subgoals for verifying data types and evaluating expressions)
(remember rules for index values)
Whole array actions
Pass as argument - a copy of the reference to the instantiated array is passed to the method. This means that any changes made to the array elements inside the method are persistent. The one exception to this is if you assign the argument to reference a different array in memory.
Assignment - changes the reference to point to the array on the RHS of the assignment operator.
Subsection11.4.1
Assume the following given declarations:
int [] alpha;
Give the contents of alpha after the execution of these statements.
int size = 4;
alpha = new int[size];
for (int i = 0; i < size; i++)
alpha[i] = i * i;