3 ms·
Java passes by value. The value being passed happens to be a copy of a pointer (properly called a "reference" in the spec, which confuses people). A copy of a p
by twblalock 8y ago
Java passes by value. The value being passed happens to be a copy of a pointer (properly called a "reference" in the spec, which confuses people). A copy of a pointer points to the same place as the original pointer. For normal use cases this works very well.
However, if you reassigned your copy of a pointer in the body of a function, the original pointer would still point to the same place it did before the function was called.
That's not the same thing as actual pass-by-reference in languages like C++.