title: iterating multidimensional array with enhanced for loop java
body: <p>When iterating through array x with an enhanced for loop what do y and z represent and how does the loop work. Here is the code I have written, it works but I don't understand exactly why and how it works. If someone could explain the syntax of the for loop when displaying a multidimensional array I would appreciate it.</p>
  
  <pre><code>// enhanced for loop
  String[][] x =
  {
      {"a", "a^2", "a^3"},
      {"1", "1", "1"},
      {"2", "4", "8"},
      {"3", "9", "27"},
      {"4", "16", "64"}    
  };
  
  for (String[] y: x)
  {
      for (String z: y)
      {
          System.out.print(z + "\t");
      }
      System.out.println();
  </code></pre>