Hi Marilyn,
Thanks for the info. But explain me the following,
if we say,
case :1
int i =0;
i = ++i;
System.out.println(i);
it gives the result as 1;
refering the book it says that the value of i is incremented and then assigned. Which is true as we get the value 1.
But if we say,
case 2:
int i =0;
i = i++;
System.out.println(i);
it gives the result as 0;
refering the book it says that the value of i is assigned and then incremented. But my question is when the value of i is incremented. I have displayed the value in the next line and it only gives 0.
Tried the same code in language C but the value i get for the second case is 1. Will you please explain this.