Re: Call by reference in Java?

From: Ekim (the.newsletter_at_gmx.net)
Date: 02/25/04


Date: Wed, 25 Feb 2004 22:48:57 +0100

okay,
thx to all of you...I think I got it at last...it already works in my
application!

by ekim

"Collin VanDyck" <thehoppocket@yahoo.com> wrote in message
news:wK6%b.9204730$Id.1533184@news.easynews.com...
> "Ekim" <the.newsletter@gmx.net> wrote in message
> news:c1isov$1ivn18$1@ID-222835.news.uni-berlin.de...
> > hmm, I'm not quite sure about it.
> > maybe you could give me an example according to my procedure-call below?
> >
> > thx,
> > ekim
> >
>
> Ok
>
> Your procedure was
>
> public void checkParameter(String strPreisProLiter, String strAnzahlLiter,
> String strPreis, String strGesamtkilometer)
> {.....}
>
> The problem is that each one of those Strings you are passing in are not
> actually the Strings themselves, but instead copies of the pointers to the
> strings (if you are more comfortable with C terminology).
>
> Whatever you do to those pointers to Strings in your function, you will
only
> be modifying copies of the pointers to the original Strings.
>
> If you are desiring to change the values of the Strings within the
function
> and have those changes be visible outside of the function, you are going
to
> need to rethink your approach.
>
> You could have your function return a Collection of new Strings that
> correspond to the changed values, or return a struct-like data structure
> that contained four Strings.
>
> Can you specify exactly what your desired effect would be? I think I'm
> getting unnecessarily complex here :)
>
> -CV
>
>



Relevant Pages

  • Re: Call by reference in Java?
    ... "Ekim" wrote in message ... > maybe you could give me an example according to my procedure-call below? ... The problem is that each one of those Strings you are passing in are not ... Whatever you do to those pointers to Strings in your function, ...
    (comp.lang.java.help)
  • Re: A97 variable length string declaration - how to do?
    ... Thx to you both. ... real need to burden myself dealing with ... fixed length strings. ... Prev by Date: ...
    (comp.databases.ms-access)
  • Re: A97 variable length string declaration - how to do?
    ... > Thx to you both. ... fixed length strings run a LOT faster! ... ms-access in some fashion, and only put in for compatibility of old basic ... Edmonton, Alberta Canada ...
    (comp.databases.ms-access)
  • Re: Trouble writing Path to registry
    ... The Strings have to be corrected to '\\' at every ... backslash. ... thx anyway. ... if someone knows how to write a function to read the registry without ...
    (comp.soft-sys.matlab)
  • Re: decrypting a XOR of two plaintexts
    ... "Bernie Cosell" wrote in message ... found it [at the cryptologia website ... > strings. ... Thx a lot! ...
    (sci.crypt)