Declaring variable in a FOR one time
<p>I have a simple question in java. I have this piece of code:</p>

<pre><code>int i1=0;
for(String x: list1)
{
    for(String y: list2)
    {

        if(x == y)
        {
            log ("Checking "+x+" with "+y+" =&gt; found a match!");
            list1.remove(i1);
            break;
        }
        else
        {
            log ("Checking "+x+" with "+y+" =&gt; not matching!");
        }
    }
    i1=i1+1;
}
</code></pre>

<p>As u can see, i'm declaring <strong>"i1"</strong> above, but is there a way to declare it in the first for just once and after the finish of that <strong>FOR</strong> to unset itself?</p>

<p>Hope you understand me.</p>
