what is the difference between pass by reference and call by reference in java ?
Answer
Java does not pass any variables by reference.
It is tempting to think of objects being passed by reference in Java -- but harmful. Variables of object type are references. When passed, they are passed by value.
In other languages, pass-by-reference and call-by-reference are the same thing.
Edit: More detail is provided in the existing stackoverflow question "Is Java pass by reference?" (Spoiler: No.)
No comments:
Post a Comment