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 Does Java support Call 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 "Does Java support Call by Reference !!" Watch "Does Java support Call by Reference !!" New topic

Does Java support Call by Reference !!

Neha Mohit
Ranch Hand

Joined: Apr 25, 2006
Posts: 87
Hello All,

I am a little confused about this now. As far as my understanding Java does not support Call by reference ; the objects when passed it is the reference value that gets passed and that too is a call by value of the reference variable. But i have of this edition of complete reference which says Java supports Call by reference.

Please help me out in this

Thanks in advance.
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
You are correct. What you were reading is wrong.

Java is call-by-value always. As you say, the thing you pass might be an object reference, but it's still passed by value.

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
What Peter said.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Neha Mohit
Ranch Hand

Joined: Apr 25, 2006
Posts: 87
Thanks to both
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3381

Even the references are passed by value

Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
I agree. Here's the link:
subject: Does Java support Call by Reference !!
It's not a secret anymore!