3 ms·
I believe the author was being as pedantic as they were in order to avoid having the discussion you just brought up. Java doesn't do "object assignment" so you
by ChuckMcM 9y ago
I believe the author was being as pedantic as they were in order to avoid having the discussion you just brought up.
Java doesn't do "object assignment" so you cannot say
Foo d = new Foo(...);
Foo c = d;
And get two objects, you have two references to the same object. If you invoke a method on c or d it will be dispatched to the same code. So c.SetVaueX(10) and print d.GetValue(x) will show you the same value of 'x'.
In C++ or other pointer languages you could have
*d = *c
which would do an assignment of the bits from one to the other, then manipulating d would manipulate its copy of the bits and manipulating c would manipulate its copy of the bits.