Objects in Java are passed by reference value. Therefore, if you pass an object, it receives a copy of the link (if you assign this link to something else, only the parameter changes, the original object still exists and the main program refers to it).
This link demonstrates a bit of passing by the value of the link .
public void badSwap(Integer var1, Integer var2) { Integer temp = var1; var1 = var2; var2 = temp; }
These are object references, but they will not be replaced, as they are only internal references in the function area. However, if you do this:
var1.doubleValue();
It will use the link to the source object.
source share