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 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 i
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
On 11/15/06, temp temp <[EMAIL PROTECTED]> wrote:
If I donot use this.aField implies that complier will never point
11/2006 07:22 AM
Please respond to "Struts Users Mailing List"
To: Struts Users Mailing List
cc:
Subject: Re: Simple java question
If I donot use this.aField implies that complier will never point to
global field ? and only way I can access the glo
If I donot use this.aField implies that complier will never point to global
field ? and only way I can access the global variable is using this ?
Thanks & Regards
Miro
[EMAIL PROTECTED] wrote: Hello temp temp,
Use this.aField inside the method.
public class Test2 {
private Strin
You can do this-
private void testField() {
String aField = "test1";
System.out.println(aField);
System.out.println("global="+this.aField);
}
Also, name you class Struts2 instead of Test2 so that it does not feel out of
place in this List.:-)
Cheer
Hello temp temp,
Use this.aField inside the method.
public class Test2 {
private String aField = " aField ";
public static void main(String[] args) {
Test2 test2 = new Test2();
test2.testField();
System.out.println(test2.aField);
}
priv
7 matches
Mail list logo