Prerequisite : Arrays in Java
Jagged array is array of arrays such that member arrays can be of different sizes, i.e., we can create a 2-D arrays but with variable number of columns in each row. These type of arrays are also known as Jagged arrays.
Following are Java programs to demonstrate the above concept.
Contents of 2D Jagged Array 0 1 2 3 4
Following is another example where i’th row has i columns, i.e., first row has 1 element, second row has two elements and so on.
Contents of 2D Jagged Array 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
This article is contributed by Rahul Agrawal. If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
- Set to Array in Java
- Array get() Method in Java
- Array of ArrayList in Java
- Reverse an array in Java
- Anonymous array in Java
- Array to Stream in Java
- Array set() method in Java
- List to array in Java
- Array Copy in Java
- Array vs ArrayList in Java
- Array getInt() Method in Java
- How to get slice of a Primitive Array in Java
- Array setFloat() method in Java
- Find max or min value in an array of primitives using Java
- Array setByte() method in Java