public class test{ public static void main(String args[]) { int i=0; i = i++; System.out.println(i); } } Answer is : 0. Can any one tell me what happens to increment operator?
In the line "i = i++;", the i on the right side of = is not incremented until afterthe value of i is assigned to the i on the left side of =. So, i is still 0 and that's what prints.