java get size of matrix
//Get rows size matrix
matrix.length;
//Get columns size of matrix
matrix[0].length;
java get size of matrix
//Get rows size matrix
matrix.length;
//Get columns size of matrix
matrix[0].length;
java length of matrix
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
}
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
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us