previous | start | next

Self Check

  1. Write a "for each" loop that prints all elements in the array data
  2. Why is the "for each" loop not an appropriate shortcut for the following ordinary for loop?
    for (int i = 0; i < data.length; i++) data[i] = i * i;

previous | start | next