Answers for "how to get the length of a jagged array java"

1

jagged array java

int[][] numbers = new int[7][];

// row 0 gets 5 columns
numbers[0] = new int[5];
// row 1 gets 11 columns
numbers[1] = new int[11];
// etc...
Posted by: Guest on February-18-2020
0

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); //2
    System.out.println(foo[0].length); //3
    System.out.println(foo[1].length); //4
}
Posted by: Guest on December-05-2020

Code answers related to "how to get the length of a jagged array java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language