Look at this GIF and i bet you will understand the basic difference between pass by value vs. Pass by reference.
Give a like!
If you find this amazing 😄
For further actions, you may consider blocking this person and/or reporting abuse
Sharad Khambe -
Mike Young -
gameon gameover -
hanna Fischer -
Top comments (1)
Gif can be very confusing by implying that after passing an object as a method argument, you can do whatever you want with it without changing the original object.
As you know, only the reference to the object is copied (finally we have two references) which still points to the same object and any modification to it will be reflected in the source object (on the heap) to which these references point.
The above gif only applies in the context of passing primitives.