9.2.4. Arrays-WE2-P4ΒΆ

Subgoals for Evaluating Arrays

  1. Set up array from 0 to size-1

  2. Evaluate data type of statements against array

  3. Trace statements, updating slots as you go

    1. Remember assignment subgoals


Arrays-WE2-P4

Assume the following given declarations:

int [] alpha;

Give the contents of alpha after the execution of these statements.

alpha = new int[5];
for (int i = 0; i < 5; i++)
   alpha[i] = i + 1;
You have attempted of activities on this page