post increment question
I was looking at this puzzle question:
public class Assignment {
public static void main(String[] a) throws Exception {
int tricky = 0;
for (int i = 0; i < 3; i++)
tricky += tricky++;
System.out.println(tricky);
}
}
tricky is 0. How come the post increment in this case does nothing?
[352 byte] By [
flybuzza] at [2007-11-27 5:11:34]

> I was looking at this puzzle question:
>
> public class Assignment {
> public static void main(String[] a) throws Exception
> {
>int tricky = 0;
> for (int i = 0; i < 3; i++)
>tricky += tricky++;
> System.out.println(tricky);
>}
>
> tricky is 0. How come the post increment in this case
> does nothing?
http://forum.java.sun.com/thread.jspa?forumID=54&threadID=753569