I know that similar questions have been asked several times and they were nicely answered but... they were about zero length array of 1 dimension like:
int[] array = new int[0]; Seems that there is a purpose for such arrays in case when null should not / cannot be used. But why Java allows to create things like that:
int[][][] multiDims = new int[5][0][9]; Of course like in simple 1D case we get nothing from such array if we try to iterate or something and I am asking only because it looks extremely nasty for me. :-) How much memory is allocated for such a pointless creature?
new int[-1]successfully ideone (it obviously fails at runtime, however). This looks like the sort of error that tools like Google's error-prone might set out to catch (although it looks like it doesn't currently, maybe because it is just too silly).