It is not giving 1 due to the line i = i++; as we know that i++ changes the value immediately after the execution not before that. In this case the assignment of previous value nullifies the impact of increment.
You can get the answer in two ways by making this statement like i++ or i=++i;.
Evacuate the building! Here, take this tiny ad with you: