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 :: java how to make a parameter optional 
Java :: find the unique element in a list java 
Java :: how to convert integer to string in java 
Java :: student information using array of object java 
Java :: give ram to java 
Java :: transparent card background android 
Java :: java xml element get attribute value 
Java :: variables in java 
Java :: jackson deserialization fail-on-unknown-properties true 
Java :: calendar check if month is 30 days 
Java :: How to initialize a 3d array in Java? 
Java :: for loop condition java 
Java :: java creare costante 
Java :: remove selected text from string value android java 
Java :: current port used by the Java application 
Java :: java string reduce 
Java :: 7877777777777777777777777 
Java :: split string to textview in android 
Java :: javaparser 
Java :: java map remove all null values 
Java :: java calendar to date 
Java :: fix nullpointerexception 
Java :: Spigot how to get block player is looking at 
Java :: array of arraylist in java 
Java :: check if short int or long java 
Java :: mergesort java 
Java :: java finally block 
Java :: java code for logarithm 
Java :: java binary tree 
Java :: array to array list java 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =