Getting an ArrayIndexOutOfboundsException when splitting a string into an array and then looping over it
<p>I am trying to send the result of a <code>split()</code> function into an array of strings, but I am getting an exception as follows:</p>

<blockquote>
  <p>java.lang.ArrayIndexOutOfBoundsException: somenumber</p>
</blockquote>

<p>I am using the following code, but it returns that exception:</p>

<pre><code>String[] temp;
temp = result.split(" ");
</code></pre>

<p>Any suggestions? I want to send the result of the string <code>split()</code> function into an array of strings, and then print the values in a for loop.</p>

<p>I am getting an out of bounds exception in for loop, I use:</p>

<pre><code>for (int i=0;i&lt;=temp.length;i++)
{
    out.println(temp[i]);
}
</code></pre>
