This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Pass by value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Pass by value" Watch "Pass by value" New topic
Author

Pass by value

Skanda Raman
Ranch Hand

Joined: Mar 21, 2008
Posts: 205

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.


Skanda
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 41104
    
  29
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.
 
I agree. Here's the link: http://kickstarter.com/rocket-mass-heater
 
subject: Pass by value