I have a method that takes in dimensions for an array in a list of params
private int[] anArray;
public MDArray(int... sizes){
anArray = new int[sizes[0]];
for (int u : anArray){
System.out.println(u);
}
If I pass in (12,13) as the params into my function, then the loop prints out 0 12 times. I am unsure about how to access the sub layers of the multi-dimensional array.
My understanding is that in Java there is no real multi-dimensional array, rather an array of arrays.
If I try
for (int[] u: anArray) {
for (int elem: u) {
System.out.println(elem);
}
}
This fails as u is not an array but an int.
I would really appreciate a hand with this.