title: Incrementing an int inside if boolean expression
body: <p>I would like to understand how can the int x be incremented inside an if (Boolean expression) for every loop iteration<br>
  How is that possible?? How does it work?</p>
  
  <pre><code>  public class MethodsTest {
  
   public static void main(String[] args) {
      int x= 0;
  
      for (int z = 0; z &lt; 5; z++) 
      {
  
          if(x++ &gt; 2){
  
          }
  
          System.out.println(x);
      }
  
  }
   }
  </code></pre>
  
  <p>the output will be<br> 
  1<br>
  2<bR>
  3<br>
  4<br>
  5</p>