aspose file tools*
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Pass by value" Watch "Pass by value" New topic
Author

Pass by value

Eshwar Prasad
Ranch Hand

Joined: Mar 21, 2008
Posts: 202
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.

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
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://aspose.com/file-tools
 
subject: Pass by value
 
Similar Threads
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
Pass by Reference in Java