Why can I use .equalsIgnoreCase("anoterString") without assigning it to a variable or within a control flow statement?
<p>I came across this code:</p>

<pre><code>    for (final String s : myList)
    {
        s.equalsIgnoreCase(test);
        updateNeeded = true;
        break;              
    }
</code></pre>

<p>I suspect that this is not what the programmer actually wanted to do. I believe he meant to write something like:</p>

<pre><code>    for (final String s : myList)
    {
        if(s.equalsIgnoreCase(test))
        {
            updateNeeded = true;
                break;
        }   
    }
</code></pre>

<p>However, I don't understand why there is no error in the first code snippet. </p>

<pre><code> s.equalsIgnoreCase(test);    
</code></pre>

<p>since the method .equalsIgnoreCase("anoterString") returns a boolean and it is not being assigned to anything or used within a control flow statement</p>
