Commit c4b4191
committed
fix: Correct 2D array initialization and iterate over letters and numbers
🧠 Logic:
- Declared a 2D `String` array `letters` of size `[3][4]` but initialized each row with 5 elements instead of 4 — this causes `ArrayIndexOutOfBoundsException`.
- Fixed the mismatch: either reduce each row to 4 elements or change declaration to `[3][5]`.
- Used enhanced for-loops to print letters row by row.
- Declared and printed 2D `int` array `numbers` using traditional nested loops.
Signed-off-by: Somesh diwan <[email protected]>1 parent 7d13cac commit c4b4191
1 file changed
+9
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
| 1 | + | |
| 2 | + | |
5 | 3 | | |
6 | 4 | | |
| 5 | + | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
17 | 14 | | |
18 | 15 | | |
19 | 16 | | |
20 | 17 | | |
21 | 18 | | |
22 | 19 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 20 | + | |
| 21 | + | |
27 | 22 | | |
28 | 23 | | |
29 | 24 | | |
30 | 25 | | |
31 | 26 | | |
32 | | - | |
| 27 | + | |
0 commit comments