Another Way of writing your program is
class Test
{
public static void main(String args[])
{
int i = 1;
//i = i++; This line is commented.
System.out.println(i++);
}
}
Since i++ is what is called as a "post- increment" operator, the compiler allows the operation following the increment statement to be performed and then does the incrementing. So in your case, first the present value of "i" which is 1 is displayed and then the increment operation is done.
Hope this helps.