int[][] m = {{2, 3}, {4, 5}};
int product = 1;
for (int[] row : m) {
for (int x : row) {
product *= x;
}
}
System.out.println(product);What is printed?
- Acheck_circle
120
- B
60
- C
100
- D
14
Explanation
2 * 3 * 4 * 5 = 120.
AP Computer Science A· difficulty 2/5
int[][] m = {{2, 3}, {4, 5}};
int product = 1;
for (int[] row : m) {
for (int x : row) {
product *= x;
}
}
System.out.println(product);What is printed?
120
60
100
14
Explanation
2 * 3 * 4 * 5 = 120.
Want 10 more like this — adaptive to your weak spots?
<codefor (int[] row : m)</code iterates…
chevron_rightFor the 4x4 matrix shown: <code class="language-java"int s = 0; for (int i = 0; i < m.length; i++) s += m[i][m.length - 1 - i]; </code</pre What is <codes</code…
chevron_rightThe highlighted (yellow) cells form…
chevron_right