Thursday, August 29, 2013

Creating arrays with size as a variable

Creating arrays with size as a variable

I am trying to create a new array in this way:
final boolean[] arr = new boolean[list.size()];
This line is throwing a null pointer in my code in some cases. Under what
situations can this happen? Can it happen when the list has zero elements?
I am sure the list is not null at this stage.

No comments:

Post a Comment