Having a problem with zero length arrays

The problem is that you are creating and initialising a 1D array (column) of 4 zero length arrays (rows).

If you try this code it demonstrates the problem

float a[][] = {{}, {}, {}, {}};
                       // OUTPUT
println(a.length);     // 4 
println(a[0].length);  // 0

a[0][0] = 3.142;       // ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
2 Likes