Forums Register Login

Pass by value

+Pie Number of slices to send: Send
In the below url of javaranch

http://www.javaranch.com/campfire/StoryPassBy.jsp
And in the below section

How does pass-by-value work with references?
Way too many people say "Java passes primitive by value and objects by reference". This is not the way it should be stated. Java passes everything by value. With primitives, you get a copy of the contents. With references you get a copy of the contents.



Please see the highlighted section,

should that mean "With reference you get a copy of the reference"

Please let me know if i am wrong.

+Pie Number of slices to send: Send
What it means is that you get a copy of the contents of the memory location.

If you have a few hours to spare, have a look at this thread from July.
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 920 times.
Similar Threads
Pass by Reference in Java
If objects can't be passed....
Does java support pass by value, pass by reference, or both?
confusion in pass by reference
pass by reference- Swapping problem
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:35:22.