Bill Tudor Bill Tudor - 7 months ago 16
Java Question

Store a function that returns an array into a two dimensional array

I'm trying to store a byte buffer into a two dimensional array.

byte[][] input = new byte[128][];
int index = 3;

ByteBuffer b = new ByteBuffer.allocate(128);
b.limit(128);

b.put....

input[index][] = b.get();


I get an illegal start of expression error at the second [ ].

Answer

Your syntax is wrong, it should be input[index] = b.get();.