Learning objectives

Declare and create an array of primitive values or of object references with new and a length, and state the default value Java places in each element

Create an array from an initializer list, read and change elements with indices from 0 to length - 1, and use the length attribute, which takes no parentheses

Traverse an array with an indexed for loop, a while loop and an enhanced for loop, and rewrite an enhanced for loop as an equivalent indexed loop

Explain why assigning a value to the enhanced for loop variable leaves the array unchanged, whereas calling a mutator through that variable changes the object stored in the array

Identify the index values that throw an ArrayIndexOutOfBoundsException, and explain what happens when one array variable is assigned to another and an element is then changed

Continue with a revision plan

These learning objectives are available to everyone. Sign in with an eligible plan to read the full note and worked examples.