----- Original Message -----
From: Gordon Keith <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: Robert Simmons <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, October 13, 1999 8:36 PM
Subject: Re: Const in java
> [EMAIL PROTECTED] wrote:
> >
> > On Wed, 13 Oct 1999, Robert Simmons wrote:
> >
> > > Since everything in java is passed by reference this becomes even more
of an issue.
> > > Therefore can I do the following to achieve the desired safety ?
> >
> > Well, everything is not passed by reference in Java. I believe
primitives
> > and immutable types are passed by value. Someone know the exact rules
> > behind this?
>
> Everything is passed by value.
> But you never actually pass objects, you only ever pass references to
> objects.
>
> Making a parameter final means you can't change what object that
> parameter refers to. (you can still make changes to the object, if it's
> not immutable)
Such is the problem there are times where I dont want the user to be able
to alter a returned object's state.
>
> Once you understand that its pretty clear what's happening.
>
> Regards
> Gordon
>
>
> Gordon Keith
> Programmer
> Marine Science Support
> Australian Antarctic Divsion
> http://www.antdiv.gov.au
>
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]