Returning the number of items in a list
<p>I have a method called <code>public int getSize()</code> and it is suppose to return the number of items in the list.  the instance variable is <code>private Listable[] items;</code>   I thought it would just be something like this: </p>

<pre><code>int size = 0;

for (int i = 0; i &lt; items.length; i++){
size++;
}

return size;
</code></pre>

<p>But when I run it through these tests I get this nullpointerexception on the <code>for (int i = 0; i &lt; items.length; i++){</code> line</p>

<p>I don't think it likes <code>items.length</code> for some reason. I'm not getting any errors in Java. How should I do this?</p>

<p>i already tried return items.length;</p>

<p>that didnt work either.</p>
