Null Pointer Exception with an array of bitsets
- by p0ny
could someone explain to me why the following results in a Null pointer Exception? And how to set a value for bitarray[0]?
BitSet[] bitarray;
bitarray= new BitSet[10];
bitarray[0].set(1);
Also, why something like this work and not result in a pointer exception?
BitSet[] bitarray = new BitSet[10];
BitSet bits = new BitSet(32);
bits.set(1);
bitarray[0] = bits;
Thanks