Skip to content

Commit d243eb2

Browse files
committed
feat: Create and print a jagged 2D array with varying column sizes per row
🧠 Logic: - Declares a 2D jagged array `A` with 3 rows. - Assigns different column lengths to each row: 5, 3, and 8. - Uses enhanced for-each loops to print all elements in each row. Signed-off-by: Somesh diwan <[email protected]>
1 parent 400a73a commit d243eb2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Section9ArrayAB/Array IMP/TwoDJaggedArray.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ public static void main(String[] args) {
1515
}
1616
System.out.println("");
1717
}
18-
*/
19-
for(int x[]:A)
20-
{
21-
for(int y:x){
18+
*/
19+
for(int x[]:A) {
20+
for(int y:x) {
2221
System.out.println(y+" ");
2322
}
2423
System.out.println("");
2524
}
2625
}
27-
}
26+
}

0 commit comments

Comments
 (0)