• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

Local parameter by value vs. reference?

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

On specification page 52, 5.3 Local Clientes, last paragraph:

"The arguments and results of the methods of the local interface and local home interface are passed by reference."

I found it a bit confusing, I think it�s by value.....Even when a reference is passed, it�s passed by value... or not?
And if an argument is a primitive?


Thanks
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is *really* bad terminology, and ironically, violates the way Sun officially describes the Java language semantics or pass-by-value. In the Java sense, local interfaces means that both the caller and the object being called are on the same heap, so it's just plain old Java pass-by-value (which as you mentioned, for object references you get the value (a copy) of the reference, and for primtives, you get a copy of the value of the primitive.

So, nothing is really pass-by-reference in the way that we use the term, but people use it differently, even within Sun.

Basically, it's something like this:

* When passing an object to or from a REMOTE method call, you pass a copy of the OBJECT.

* When passing an object to or from a LOCAL method call, you pass a copy of the REFERENCE.

* For primitives, it makes no difference--you're always getting a copy of the value of the primitive.

cheers,
Kathy
 
Joseph Edward
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Kathy, it�s all clear now

Edward
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic