Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
problem with fianl & static variable.
- From: abhishek_sharan@xxxxxxxxxxxxxxxxxxxxxxxxxxxx (Abhishek sharan)
- Subject: problem with fianl & static variable.
- Date: Mon, 31 Jan 2000 10:06:53 +0530
"Pratap Malani, Gurgaon" wrote:
> Hello all,
> This could be a simple problem but I m unable to understand. These are the
> lines of code I have written :
> Void function()
> {
> final EditBox edit = this ; // EditBox is my class with extends
> JTextBox.
> static int once;
> once = 1;
> ..........
> ..........
> }
>
> when I compile it I get the following error.
>
> EditBox.java:57: '}' expected.
> final EditBox edit = this ;
> ^
> EditBox.java:58: Statement expected.
> static int once;
> ^
> EditBox.java:59: Identifier expected.
> once = 1;
> ^
> 3 errors
>
> I cannot figure out what is wrong. Can anyone please help me.
> Thanks in advance.
>
> Bye.
> With Warm Regards And Best Wishes.
> Pratap Malani.
>
> ---
> To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
> To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx
Hi Pratap
EditBox.java:59: Identifier expected.
once = 1;
^
u r getting the above error because "once" has been declared as a static
variable
then again somewhere in u r code u want to assign the value 1 to it then
since it is a static variable u need the refer it as" EditBox.once =1"
the complier complains when u r write once=1 cause complier sees it as an
instance variable without
any type .
hope it helps
Bye
Abhishek Sharan
MTS,InterSolutions
Noida
---
To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx
- References:
- problem with fianl & static variable.
- From: Pratap Malani, Gurgaon
- problem with fianl & static variable.
- Prev by Date: using different colors in TextArea
- Next by Date: Info :Cookies
- Previous by thread: problem with fianl & static variable.
- Next by thread: problem with fianl & static variable.
- Index(es):