File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Pass by value" Watch "Pass by value" New topic

Pass by value

Skanda Raman
Ranch Hand

Joined: Mar 21, 2008
Posts: 205

In the below url of javaranch
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

Joined: Oct 13, 2005
Posts: 46435
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:
subject: Pass by value
It's not a secret anymore!