What will the following code bring?
 
int i = 0;
i++;
System.out.print(i);
i = i++;
System.out.println(i);
Explanation
The result of the expression i++ if i=1 will still be 1, as it is a postfix operator.
After executing the postfix operator, the value of i becomes equal to 2, but i will be re-written as unit as a result of the assignment operator fulfillment i = i ++

Mobile Beta

Get it on Google Play
or Subscribe for future quizzes