• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Local parameter by value vs. reference?

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Kathy, it�s all clear now

Edward
 
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic