Null Pointer Exception with an array of bitsets
Posted
by
p0ny
on Stack Overflow
See other posts from Stack Overflow
or by p0ny
Published on 2012-09-24T03:32:10Z
Indexed on
2012/09/24
3:37 UTC
Read the original article
Hit count: 156
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
© Stack Overflow or respective owner