how to get the dimensions of a 2d array in java
public class Main {
public static void main(String[] args) {
int[][] test = new int[10][4];
int rows = test.length;
int coloumns = test[0].length;
System.out.println(rows);
System.out.println(coloumns);
}
}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
}
Also in Java:
- arraylist get last
- searching in database using java
- stack class in java
- java foreach map
- use regex in if statement java
- java create unmodifiable list
- how to return the lower of two values in one line java
- java list as parameter
- JOptionPane with drop down list java
- java how to show an array
- sum of arraylist java 8
- check if value exists in hashset java
- java unique id
- take a value from keyboard java
- how to add java_home in mac
- isSelfDivisor java
- convert from integer to character java
- java convert edittext to double
- find the triplet sum in java linked list
- java quit application
- Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
- java output length of each line in a text document
- how to find substring in java
- floor in java