So there is no added benefit to declaring a parameter final other than to
allow access from inner classes within the method.
On Thu, 14 Oct 1999, Vartan Piroumian wrote:
> Hi folks,
>
> All parameters are ALWAYS passed by value in Java.
>
> When the parameter being passed is an object reference it is the
> VALUE OF THE REFERENCE that is passed by value, not the object being
> referenced.
>
> This may seem like a moot distinction, but it is not. A method cannot
> destroy the reference passed to it by changing the value of the formal
> parameter. The formal parameter is a copy.
>
>
> Regards,
>
> Vartan
>
>
>
> [EMAIL PROTECTED] writes:
> > 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? I always have to write a little test program to remember.
> > Okay, I'll stop being pedantic.
> >
> > I think if you do
> >
> > public void myFunction(final SomeClass var) {
> > .. whatever ..
> > }
> >
> > Will do what you desire. Not positive though so some of the other wiser
> > folks on the list might wish to confirm this.
> >
> >
> > ----------------------------------------------------------------------
> > To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
>
>
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
>
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]