Re: Java Trivia

2002-02-01 Thread Bernard Choi

Java indeed does have pointers. It's just hidden from the coder's point of
view. Behind the scenes, objects are still referenced by pointers and what
not.

- Original Message -
From: "Jonathan Gibbons" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, February 01, 2002 10:02 PM
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,



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




RE: Java Trivia

2002-02-01 Thread Bill Page

yes, but one difference between java and say C++ is that in C++ you can pass
the actual pointer meaning that you can make it point to another instance of
the object in addition to change the internal attributes.  In Java because
the pointer is always passed by value (or perhaps a copy of the pointer if
you like), you can change the internal stuff, but never the instance of the
object.

bp

-Original Message-
From: Olivier Dinocourt [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 8:53 AM
To: Struts Users Mailing List
Subject: Re: Java Trivia


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.


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




Re: Java Trivia

2002-02-01 Thread Olivier Dinocourt

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]>




RE: Java Trivia

2002-02-01 Thread Jonathan Gibbons


Hurray!  I was getting worried.

And in the UK, its almost time to go home.

J.


 Message History 



From: "Galbreath, Mark" <[EMAIL PROTECTED]> on 01/02/2002 09:59 EST

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

To:   "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
cc:
Subject:  RE: Java Trivia


Like I said...it's Friday  ;-)

-Original Message-
From: Jim Bell [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 9:14 AM
To: Struts Users Mailing List
Subject: RE: Java Trivia


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:[EMAIL PROTECTED]]
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" <[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]>


--
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]>






--

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]>




RE: Java Trivia

2002-02-01 Thread Galbreath, Mark

Like I said...it's Friday  ;-)

-Original Message-
From: Jim Bell [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 9:14 AM
To: Struts Users Mailing List
Subject: RE: Java Trivia


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:[EMAIL PROTECTED]]
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" <[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]>


--
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]>




RE: Java Trivia

2002-02-01 Thread Jim Bell

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:[EMAIL PROTECTED]]
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" <[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]>


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




RE: Java Trivia

2002-02-01 Thread Charlesworth, Chico


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]>




RE: Java Trivia

2002-02-01 Thread Jonathan Gibbons


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]>




RE: Java Trivia

2002-02-01 Thread Galbreath, Mark

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:   
For additional commands, e-mail: 




RE: Java Trivia

2002-02-01 Thread Mikkel Bruun

 Ehh...

primitives vs ojbects???

by value or by ref...

whats the point??

-Original Message-
From: Galbreath, Mark
To: Struts (E-mail); J2ee (E-mail)
Sent: 01-02-2002 14:40
Subject: Java Trivia

What's the difference between

int i = 3;
someMethod( i);

and

Point p = new Point( 3, 3);
someOtherMethod( p);

?

Mark

--
To unsubscribe, e-mail:

For additional commands, e-mail:


--
To unsubscribe, e-mail:   
For additional commands, e-mail: