• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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
 
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic