Zachary Griggs wrote:So, in "a = ++n", the ++n operator means the ++ takes place first. In other words, it's essentially doing the following: "n++; a = n"
In "b = n++", the ++ happens last. So you can think of it as: "b = n; n++"
That is a good explanation. Thank you. My confusion wasn't about the final value of a or b from n++ or ++n. I understand how both the pre and post increment and decrement works. What confused me was the precedence of the two. Like I said in my question earlier, if post increment has a higher precedence than pre increment, why does it take effect later than pre. I mean, shouldn't Java use the pre increment to hide the increased value?
So my understanding is that even though the n++ has higher precedence and is evaluated first than other operators, but it just has one special talent, it hides its calculated value.
I am bad at asking questions. It's hard for me to express my question. Sorry about that. And thanks for everyone's help!