Write a java program to create a jagged array of 2 rows with user defined column size and display all the values along with sum(rows). code example
Example 1: jagged array java
int[][] numbers = new int[7][];
numbers[0] = new int[5];
numbers[1] = new int[11];
Example 2: how to get the length of a jagged array java
public static void main(String[] args) {
int[][] foo = new int[][] {
new int[] { 1, 2, 3 },
new int[] { 1, 2, 3, 4},
};
System.out.println(foo.length);
System.out.println(foo[0].length);
System.out.println(foo[1].length);
}