3 ms·
Apparently it’s nothing specific about arrays or ++ — any expression on the left hand side of the compound operator is evaluated twice, so any side effects happ
by wrs 8y ago
Apparently it’s nothing specific about arrays or ++ — any expression on the left hand side of the compound operator is evaluated twice, so any side effects happen twice.
- nine_k 8y agoIf you read the original post to the end, you'll notice a piece of code that seemingly refutes this statement. That is, in case of Java 8, the index expression is evaluated once. and in case of Java 9, twice.
- Dylan16807 8y agoWhat does that refute? You seem to be agreeing with the post you're replying to. But importantly your original point about "depending on order of their evaluation" is wrong. Most of the examples don't care about order at all. They break because things happen the wrong number of times.
- asdsa5325 8y agoRead his comment again.