Re: Const in java

1999-10-15 Thread Brandon Anderson
On Fri, 15 Oct 1999, Robert Simmons wrote: > > - Original Message - > From: Gordon Keith <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Cc: Robert Simmons <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, October 13,

Re: Const in java

1999-10-15 Thread Michael Emmel
> > > Such is the problem there are times where I dont want the user to be able > to alter a returned object's state. > Thats easy just add a lock variable that take the ( Caller) as a prameter to set. Or its not public. Check that on each method invoction which effects state. I'm not sure of

Re: Const in java

1999-10-15 Thread Robert Simmons
- 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: > > > &

Re: Const in java

1999-10-14 Thread Michael Sinz
On Thu, 14 Oct 1999 09:26:32 -0500 (CDT), Alex M. wrote: >So there is no added benefit to declaring a parameter final other than to >allow access from inner classes within the method. Well, that is one benefit. But the other benefit is a code maintainance and readability issue. By saying that

Re: Const in java

1999-10-14 Thread Vartan Piroumian
OK, last one, and then maybe we should take this "offline" because it is not a Java linux question... A "final" parameter is REQUIRED by the compiler if the variable is referred to by an inner class. All local variables must be declared final when referred to by inner class definitions. This i

Re: Const in java

1999-10-14 Thread Alex M.
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 referenc

Re: Const in java

1999-10-14 Thread Vartan Piroumian
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 ref

Re: Const in java

1999-10-13 Thread Gordon Keith
[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 beli

Re: Const in java

1999-10-13 Thread Michael Emmel
[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

Re: Const in java

1999-10-13 Thread Matt Welsh
Robert, Since most of your questions are general Java questions and have nothing to do with the Linux port of the JDK, can you please direct them elsewhere? The USENET group comp.lang.java.programmer is probably a good place to ask. Thank you, Matt Welsh, UC Berkeley "Robert Simmons" <[EMAIL P

Re: Const in java

1999-10-13 Thread jools enticknap
Hi Robert, Adding the final keyword to a variable in an argument list only means that the reference is final, ie you can't make the reference refer to another object. I does not mean that I can't call certain methods in the same way as C++. Regards --Jools >From: "Robert Simmons" <[EMAIL PR

Re: Const in java

1999-10-13 Thread alx
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