Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java 2d array length

  int[][] test; 
  test = new int[5][10];

  int row = test.length;
  int col = test[0].length;
Comment

2d array length in 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 // gives count of rows
    System.out.println(foo[0].length); //3 // gives count of columns for particular row
    System.out.println(foo[1].length); //4
}
Comment

how to get length of 2d array java

int[][] array2D = { {1,2,3,4,5,6}, {7,8,9,10} };
int length = array2d[0].length + array2d[1].length; // 10
Comment

PREVIOUS NEXT
Code Example
Java :: can we override the overloaded method in java 
Java :: different constructiors in java and what they do explained 
Java :: generate hash in java 
Java :: switch statement in java 
Java :: java create a string 
Java :: java sort reverse lambda 
Java :: format specifier in java 
Java :: menu alert dialog in android 
Java :: is it possible to declare two conditions in for loop in javascrip 
Java :: springboot validator manually validate 
Java :: spring mvc 
Java :: why we use return method 
Java :: java returns null 
Java :: java programming problems 
Java :: java convert int to string 
Java :: fabricmc concat text 
Java :: output folder director 
Java :: Method Overloading by changing the data type of parameters Java 
Java :: two dimensional arraylist in java 
Java :: java listfiles filter 
Java :: java cambiar formato de fecha 
Java :: open cv for java 
Java :: java mcq test 
Java :: Calculator repeat 
Java :: Java public no-arg constructors 
Java :: Algorithms - filtering 
Java :: configuration reader java 
Java :: find maximum number of rides in amusement park python 
Java :: OCA Exam Questions 
Java :: split the argument String and add the tokens into a list 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =