Yep, and why we are at it make sure you don't just rename one of them to
afield or a_Field or something similar, you get the pattern :-D It might seem to be a good idea and saves you from coming up with some other name but it could cause headache to others or even yourself later on ... Tamas On 11/15/06, Christopher Goldman <[EMAIL PROTECTED]> wrote:
On Wed, 2006-11-15 at 06:33 +0800, Tamas Szabo wrote: > Well, it isn't a global field is an instance variable of your class. > And there is another way to access it. Just rename either the instance > variable or the local variable. > > Tamas Right. While it is possible to do this, it does make it difficult to read the code. Better to use two different variable names. Then you never have to worry about which variable you're actually using, or mistakenly use the instance variable because you *thought* the local one was still in scope, when it was not. Actually the one exception I employ is with setter methods: public void setFoo( Object foo ) { this.foo = foo; } Chris -- Christopher D. Goldman [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]