struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Bell" <JB...@vcgsoftware.com>
Subject RE: Java Trivia
Date Fri, 01 Feb 2002 14:14:26 GMT
Perhaps this discussion is better suited for another mailing list, but in an attempt to bring
it to closure...

Java doesn't expose its pointers for manipulation, but its object references can be considered
pointers, if you like.

Yes, Java is a "pass-by-value" language on the surface, but it uses "pass-by-reference" when
passing objects (not primitives) around.  Otherwise, it would need to perform expensive "deep-cloning"
of objects before passing objects as parameters.  I like to think of Java as doing "pass-reference-by-value"
when objects are involved.

Now I notice that the original message was posted to the J2EE mailing list too.  Perhaps I
should have left it to those folks to address.  After all, we already receive a plethora of
messages from this list each day.

HTH

Jim Bell

-----Original Message-----
From: Jonathan Gibbons [mailto:jonathan.gibbons@db.com]
Sent: Friday, February 01, 2002 9:02 AM
To: Struts Users Mailing List
Subject: RE: Java Trivia



Java doesn't have pointers!  Just mudying the waters, or was it serious?  If so sorry.

Think of it as chucking water over someone, as opposed to passing them a cup of water.  Thats
pretty similar.

or, um, having someone talk to you, rather than pass you a piece of paper. hmmm.

J,


---------------------------------------- Message History ----------------------------------------


From: "Galbreath, Mark" <Galbreath@tessco.com> on 01/02/2002 08:48 EST

Please respond to "Struts Users Mailing List" <struts-user@jakarta.apache.org>

To:   "'Mikkel Bruun'" <mikkel.bruun@valtech.dk>; "Struts (E-mail)"     <struts-user@jakarta.apache.org>
cc:
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:mikkel.bruun@valtech.dk]
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:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>






--

This e-mail may contain confidential and/or privileged information. If you are not the intended
recipient (or have received this e-mail in error) please notify the sender immediately and
destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material
in this e-mail is strictly forbidden.



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message