new T[7] creates an array of 7 Ts. If we replace T with int[5], we get new int[5][7] which should create an array of 7 arrays of 5 integers. However, it creates an array of 5 arrays of 7 integers instead. Is there any good reason for this? Wouldn’t it make more sense if it was the other way around?
new T[7] creates an array of 7 T s. If we replace T with
Share
I think of it as dimensions:
Or
That’s why it makes sense for it to be 5 arrays of 7 ints to me. There is a kind of natural order.
I think your example also makes sense and is very logical. So I guess it’s just a matter of opinion 😛