Question: java. Can you explain me the following code? the output is 5 7 9 3 6 8 public class TwoDimensionalArrays { public static void main(String[]
java. Can you explain me the following code?
the output is
5 7 9
3 6 8
public class TwoDimensionalArrays {
public static void main(String[] args) {
int[][] x = {{5, 7, 9}, {2, 5, 7}};
for (int i = 0; i < x.length; i++) {
for (int j : x[i]) {
System.out.print((i + j) + " ");
}
System.out.println();
}
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
