I want to create multidimensional array which has levels, groups and items.
A multi-dimensional array is an array with more than one level or dimension. For example, a 2D array, or two-dimensional array, is an array of arrays, meaning it is a matrix of rows and columns (think of a table).
You create a multidimensional array using the array() construct, much like creating a regular array. The difference is that each element in the array you create is itself an array. For example: $myArray = array( array( value1 , value2 , value3 ), array( value4 , value5 , value6 ), array( value7 , value8 , value9 ) );
Examples: Two dimensional array: int[][] twoD_arr = new int[10][20]; Three dimensional array: int[][][] threeD_arr = new int[10][20][30];
Why not create an array of your custom defined objects?
class A{
int t;
int b;
}
List<A> test = new ArrayList<A>();
test.add(new A());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With