Store an array within a 2d array Java

Viewed 141

So why doesn't this work? Not really sure why this isn't possible- I just want to store an array of size 2 inside a 2d array.

I know this would be equivalent to setting storage[0][0] = array[0] and storage[0][1] = array[1], but just wondering why this is incorrect.

public class Test {

    public static void main(String[] args) {
        boolean[][] storage = new boolean[10][2];
        boolean[] array = new boolean[2];
        array[0] = true;
        array[1] = false;

        storage[0][] = array; //Why can't I do this?
    }
}

Thanks in advance

3 Answers
Related