Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Does Java support Call by Reference !!

 
Neha Mohit
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What Peter said.
 
Neha Mohit
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to both
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even the references are passed by value
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic