title: Java do while loop increment
body: <pre><code>int i = 10; 
  int j = 0; 
  do { 
      j++; 
      System.out.println("loop:" + j); 
      while (i++ &lt; 15) {                //line6 
           i = i + 20; 
           System.out.println(i); 
      } ; 
  } while (i &lt; 2); 
  System.out.println("i_final:" + i); 
  </code></pre>
  
  <p>Output: </p>
  
  <pre><code>loop:1 
  31 
  i_final:32
  </code></pre>
  
  <p>Why the <code>i_final</code> is <code>32</code> and not <code>31</code>? As we can see the <code>do_while</code> loop has executed only once, so line 8 should also have executed only once, hence incrementing the value of "i" by 1. When did <code>31</code> increment to <code>32</code>?</p>