A confusing while loop in Java
<p>Let's look at the following day-to-day example of Java.</p>

<pre><code>package loop;

final public class Main 
{
    public static void main(String[] args) 
    {
         long temp=1000000000;

        while(temp--!=0)
        {
            temp-=temp++;
            System.out.println("Inside loop = "+temp);
        }
        System.out.println("Outside loop = "+temp);
    }
}
</code></pre>

<hr>

<p>In the above simple code, the <strong>while</strong> loop iterates over only once though the local variable <strong>temp</strong> of type <strong>long</strong> contains a large value which is <strong>1000000000</strong>.</p>

<hr>

<p>Through the statement <code>System.out.println("Inside loop = "+temp);</code>, it displays <strong>Inside loop = 0</strong> and through this statement <code>System.out.println("Outside loop = "+temp);</code>, it displays <strong>Outside loop = -1</strong>. Why is it so?</p>
