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 random Double between 
Java :: how to convert an object into string with different fields in java 
Java :: PlatformException (PlatformException(error, Neither user 10024 nor current process has android.permission.WAKE_LOCK., null, java.lang.SecurityException: Neither user 10024 nor current process has android.permission.WAKE_LOCK. 
Java :: primefaces custom validation 
Java :: how to change top of window in java 
Java :: java ee check if session exists or is new 
Java :: formartted string java 
Java :: append button java 
Java :: convert class to xml string 
Java :: java for range loop 
Java :: input java 
Java :: java main class 
Java :: how to truncate an array in java 
Java :: Multiply two Strings Leetcode 
Java :: spigot remove every entity 
Java :: java doreturn void 
Java :: change java version maven 
Java :: how to instantiate hashmap in java 
Java :: get file dimension java 
Java :: how to check if a string is empty or null in Android Studio 
Java :: android studio fragment findviewbyid 
Java :: get text from edittext android 
Java :: java cheat sheet 
Java :: bukkit Command sender is player 
Java :: char default value in java 
Java :: java or symbol 
Java :: solid principles in programming 
Java :: optional throw if present 
Java :: String by byte array in java 
Java :: java do something after x seconds without stopping everything else 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =