Skip to content

Commit 5efe810

Browse files
committed
Jagged Array in Java:
A Jagged Array is a multidimensional array where the rows can have different lengths. Signed-off-by: Somesh diwan <[email protected]>
1 parent e3b5b2c commit 5efe810

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Section9ArrayAB/Array IMP/Jagged Array in Java.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ Jagged Array in Java:
22

33
A Jagged Array is a multidimensional array where the rows can have different lengths.
44

5-
Unlike a regular 2D array, where each row has the same number of columns, a jagged array allows each row to have a
6-
different number of elements.
5+
Unlike a regular 2D array, where each row has the same number of columns,
6+
a jagged array allows each row to have a different number of elements.
77

88
Key Points:
99

10-
- Declared as an array of arrays.
10+
- Declared as an array of arrays.
1111
- Each row can have a different length.
1212
- Useful when dealing with data structures like triangular matrices.
1313

1414
---
1515

16-
Code Example
16+
Code Example:
1717

1818
public class JaggedArrayExample {
1919
public static void main(String[] args) {
@@ -45,4 +45,4 @@ When to Use Jagged Arrays?
4545

4646
- When each row requires a different number of elements.
4747
- Optimizing memory usage when working with uneven datasets.
48-
- Storing hierarchical or triangular structures.
48+
- Storing hierarchical or triangular structures.

0 commit comments

Comments
 (0)