class One { public static void main(String[] args) { int i = 3; int j = 5; j = i++ + (1 - ++i); // 3 // i becomes 4 // 3 + (1 - 5) and i has become 5 in the process // 3 + 1 - 5 // which makes j -1 and i 5 at this stage System.out.println( j ); // -1 System.out.println( i ); // 5 // i is 5 at this stage i = i + 1; // same as i +=1; also same as i++; also same as ++i; System.out.println( i ); // i is 6 now i = i++; System.out.println( i ); // i stays 6 i = ++i; System.out.println( i ); // i becomes 7 and then stays 7 System.out.println("The exercise: "); i = 3; j = 5; j = i++ - ++i; System.out.println( j ); System.out.println( i ); } }