Originally posted by Amond Adams:
Any Veterans since Oct 4th. Or any news on how to conduct now for the exam, since I hear its pretty tough. In fact the Suned guy who signed me up for the Voucher was either pretty cynical or amazed that I would be appearing for SCJP without any experience or going through any Sun approved Training.
Love u all.
Originally posted by Jane Griscti:
If you re-write the code as follows:
You'll see an output of:
'a' IS assigned a value of '11' after the postfix, but since the expression result is also assigned to 'a' in the original version, the postfix result is overwritten.
Java does something like this:
- Evaluate 'a', which is 10.
- Postfix operator has highest precedence. Take the initial value of 'a', 10, and keep it in memory for use in the '+' expression. Increment 'a' by '1'; so 'a' = 11.
- Now do the '+', initial value of 'a' + initial value of 'a' = 10 + 10 = 20
- The right hand side of the expression completes, with a value of '20'.
- Assign the result, 20, to 'a' which OVERWRITES the old value of 11.
Hope that helps.