title: Java Incremental operator query (++i and i++)
body: <p>I have the following code:</p>
  
  <pre><code>public class Book {
      private static int sample1(int i) {
          return i++;
      }
      private static int sample2(int j) {
          return ++j;
      }
  
      public static void main(String[] arguments){ 
          int i = 0;
          int j = 0;
          System.out.println(sample1(i++)); //0
          System.out.println(sample1(++i)); //1
          System.out.println(sample2(j++));//1
          System.out.println(sample2(++j));//2
          System.out.println(i);//2
          System.out.println(j);//2
      }
  }
  </code></pre>
  
  <p>My expected output is in comments. The actual output is below:</p>
  
  <pre><code>0
  2
  1
  3
  2
  2
  </code></pre>
  
  <p>I'm getting confused with the function calls and incemental operator. Can someone kindly explain the actual result?</p>