Originally posted by mrudul joshi:
What does the following statement mean?
What is exactly, the state of the source object?
Thanks
In this context, the state of the object can be thought of as the actual object binary
pattern. When you assign one reference to another, the original object remains intact, while the contents of the assigned reference (its binary pattern) gets copied into the reference variable to the left, so both references refer to the same object on the heap. Remember, when you use == operator, you compare the bit patterns?
This has to do with the
Java pass-by-value notation - everything is passed by value, even references.