Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #length #jagged #array #java
ADD COMMENT
Topic
Name
2+6 =