File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Java - pass by value and pass by reference Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java - pass by value and pass by reference" Watch "Java - pass by value and pass by reference" New topic
Author

Java - pass by value and pass by reference

marlajee Borstone
Ranch Hand

Joined: Jun 26, 2008
Posts: 35
Hi friends, I find this site as great site to increase knowledge. Thanks to JavaRanch !!

As I am stuck today as I could read somewhere Java supports only Pass-by-value and not pass-by-reference.

Can someone prove it that Java does not support Pass-by-Reference. I want to see some java beginner level code example for proof.

regards,
Dhaansumall
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624



This question gets asked a lot. Take a look at this and this recent threads on the subject. You can also search the beginner forum for pass by value and find a number of discussions on the subject.
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

You can also take a look at the Pass By Value campfire story (a fun name for a lesson) here at JavaRanch. It does a nice job of explaining the concept, and has some examples. Things get a little more confusing when dealing with objects and references to objects. The campfire story can help clear things up.
[ July 26, 2008: Message edited by: Mark Vedder ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Java - pass by value and pass by reference