Sample Java array
<p>Please help me with this Java array question:</p>

<p>The following code is designed to set <code>index</code> to the location of the first occurrence of target in the array <code>a</code>, and to set <code>index</code> to -1 if <code>target</code> is not found in <code>a</code>. </p>

<pre><code>index = 0;
while(a[index] !=target){
    index++;
}
if(a[index] !=target){
    index = -1;
}
</code></pre>

<p>Which of the following describes the condition under which this program segment will fail to perform the task described?</p>

<p>A) Whenever <code>target</code> is the first element of the array</p>

<p>B) Whenever <code>target</code> is the last element of the array</p>

<p>C) Whenever <code>target</code> is not present in the array</p>

<p>D) Whenever <code>target</code> is -1</p>

<p>E) Whenever <code>target</code> = <code>a[target]</code></p>