Re: pass by reference
- From: Lew <lew@xxxxxxxxxxxxx>
- Date: Fri, 04 Apr 2008 07:38:28 -0400
Chase Preuninger wrote:
All objects are "passed by reference" and all primitive types have
their value copied.
As others have stated and illustrated in this thread, that is not actually accurate. That's why those quote marks, presumably.
In the sense that C++ programmers use "reference", Java objects are passed by value, and the official word in Java is that references are passed by value just as primitives are.
In any event, reassigning the formal parameter within a method does not change the reference passed from the caller's point of view.
Stefan Ram provided good examples of idioms to handle the OP's need.
--
Lew
.
- References:
- pass by reference
- From: angelochen960@xxxxxxxxx
- Re: pass by reference
- From: Chase Preuninger
- pass by reference
- Prev by Date: Re: pass by reference
- Next by Date: Re: pass by reference
- Previous by thread: Re: pass by reference
- Next by thread: Re: pass by reference
- Index(es):
Relevant Pages
|