> On Apr 2, 2018, at 4:09 PM, Stewart Aitken <[log in to unmask]> wrote:
> When I make width equal or larger than height it works just as expected.
> But once reversed it gives this out of bounds error and I just wondered if it could be a JAVA bug rather than this code.

ObjectGrid2D is simple.  On initialization it contains:

1. A WIDTH instance variable.
2. A HEIGHT instance variable.
3. A 2D array of Objects which is [WIDTH] by [HEIGHT]

If you do
	new ObjectGrid2D(5, 6)

... you'll get a 2D array which is 5x6.

If you do
	new ObjectGrid2D(6, 5)

... you'll get a 2D array which is 6x5.

There's nothing special about this at all.  This tells me that it almost certainly has to be a bug in your code.  However your code only calls new ObjectGrid(...) once and doesn't seem to do anything special with it.  So it's got to be somewhere *else* in your code.