Commit c85e15f
committed
feat: Iterate over 2D array with enhanced for-loops and print elements
🧠 Logic:
- Defines a 3×3 matrix using a 2D array literal.
- Uses an outer for-each loop (`for (int[] row : matrix)`) to iterate through each row.
- Uses an inner for-each loop (`for (int element : row)`) to iterate through and print each element.
- Correctly prints `element` instead of `matrix.length` to display the actual array values.
Signed-off-by: Somesh diwan <[email protected]>1 parent eff0c28 commit c85e15f
1 file changed
+4
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
11 | 7 | | |
12 | 8 | | |
13 | 9 | | |
| |||
0 commit comments