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 :: simple function java 
Java :: final in java 
Java :: programmatically click button javafx 
Java :: java add elements array 
Java :: heap in java 
Java :: set look and feel system default java 
Java :: linear search java 
Java :: String remove duplicate method in java 
Java :: java is list ordered 
Java :: code to include layout from java in android 
Java :: calculate time java 
Java :: java sort a Map by keys reverse descending order 
Java :: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification 
Java :: HOW TO PARSE a string into a number in java 
Java :: how to copy array in java 
Java :: what does setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) is used for 
Java :: java write to a file 
Java :: java String revers 
Java :: java delete object 
Java :: How to use java 8 comparator 
Java :: what is transient in java 
Java :: Quick Sort Java Implementation 
Java :: array to string java 
Java :: System.out.printf("%"+(n)+"s ") 
Java :: java timeout 
Java :: android java textview weight programmatically 
Java :: java string vs stringbuilder 
Java :: comparacion de strings java 
Java :: regex double quote java 
Java :: index of an array procesing 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =