posted 1 year ago

- 1

Laimonas,

Welcome to CodeRanch! It's an interesting question.

For this to make sense, imagine Java is adding parenthesis to specify the order. Your example is equivalent to:

Then it starts evaluating with the "inner" parens and we have:

Since x++ is postfix, this happens after the "4" is grabbed for the expression

Welcome to CodeRanch! It's an interesting question.

For this to make sense, imagine Java is adding parenthesis to specify the order. Your example is equivalent to:

Then it starts evaluating with the "inner" parens and we have:

Since x++ is postfix, this happens after the "4" is grabbed for the expression

[OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]

Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2