yes and no.

the point is not really whether arguments are passed by reference or value.
It is rather whether a chang to the argument inside the method will be
reflected outside. In the case of Objects, it will. In the case of
primitives (including Strings, if I am not wrong), it won't.

olivier (hoping he has not just written bullshit... :)

----- Original Message -----
From: "Galbreath, Mark" <[EMAIL PROTECTED]>
To: "'Mikkel Bruun'" <[EMAIL PROTECTED]>; "Struts (E-mail)"
<[EMAIL PROTECTED]>
Sent: Friday, February 01, 2002 2:48 PM
Subject: RE: Java Trivia


> Obviously, the first is passed by value, but the second?  We know p will
> reference the same object it referenced before the method invocation - the
> memory location it points to is the same.  Because p will always point to
> the same memory location, is it not also passed by value?
>
> ;-)
>
> -----Original Message-----
> From: Mikkel Bruun [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 01, 2002 8:44 AM
>
>  Ehh...
>
> primitives vs ojbects???
>
> by value or by ref...
>
> whats the point??
>
> -----Original Message-----
> From: Galbreath, Mark
> To: Struts (E-mail); J2ee (E-mail)
>
> What's the difference between
>
> int i = 3;
> someMethod( i);
>
> and
>
> Point p = new Point( 3, 3);
> someOtherMethod( p);
>
> ?
>
> Mark
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to