Java does have pointers, it is just hidden from the developer!

And if you are passing objects around it depends if they are mutable or not.
For instance if you pass a primitive value in a method and then change its
value, it's only changed inside that method call cause primitives are
immutable. The same thing for Strings because they are immutable, you cannot
change the contents of the string once been set.

But for instance for StringBuffer it is not the case because they are
mutable, the same which vectors and so on. If you want a separate copy of
that instance you must use the clone method. Therefore if you pass a Vector
in a method and then change it inside that method, it will have changed the
instance you passed in.

Chico.

-----Original Message-----
From: Jonathan Gibbons [mailto:[EMAIL PROTECTED]] 
Sent: 01 February 2002 14:02
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" <[EMAIL PROTECTED]> on 01/02/2002 08:48 EST

Please respond to "Struts Users Mailing List"
<[EMAIL PROTECTED]>

To:   "'Mikkel Bruun'" <[EMAIL PROTECTED]>; "Struts (E-mail)"
<[EMAIL PROTECTED]>
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:[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]>






--

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:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

-- 
The content of this e-mail is confidential, may contain privileged material
and is intended solely for the recipient(s) named above. If you receive this
in error, please notify Software AG immediately and delete this e-mail.

Software AG (UK) Limited
Registered in England & Wales 1310740
Registered Office: Hudson House, Hudson Way,
Pride Park, Derby DE24 8HS

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

Reply via email to