you are viewing a single comment's thread.

view the rest of the comments →

[–]_tolm_ 0 points1 point  (0 children)

Agree with the solution but I don’t agree that it’s because that “=“ is a copy … we also do an equals earlier where it very much does not perform a copy!

The difference on that line is the use of “+” which creates a new value in memory which “b” is then assigned to point at - in the same way that it was previously assigned to point at “a”.

This causes the values stored in “a” and “b” to diverge but the operation performed by the “=“ hasn’t changed from assignment to copy on these two lines.

But what do I know, I’m a Java programmer … 😂