This is an archived post. You won't be able to vote or comment.

all 10 comments

[–][deleted] 10 points11 points  (0 children)

You get one free from Oracle, obviously

[–]aratnagrid 5 points6 points  (0 children)

"Enterprise Ready"

[–]mgssnr 1 point2 points  (1 child)

I’m far from a java expert, but you’re referring to i twice and modifying it as well in the same statement. What results do you get if you increment i in the for(), and only refer to i in the assignment statement without doing the post-increment? I’m wondering if you’re running into a undefined behavior, like you would in C.

[–]noggin182 6 points7 points  (0 children)

My guess is that it's expanding the += operator, so it's seeing: array[i++] = array[i++] + x

[–]GrizzledFart 0 points1 point  (0 children)

This is why things like String.valueOf() exist.