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.
// 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();