No Problem ashish, you can do one thing, don't initialize it, only declare the variable as final and assign the value at run time but you can assign
Only one time means subsequent attempts to assign a value to a Final variable result in a compiler error.
Simply declare the local variable and initialize it later, like this:
final int intVar;
. . .
intVar = 0;
cheers
Sunil
-----Original Message-----
From: Ashish Kulkarni [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 27, 2005 12:38 AM
To: user@struts.apache.org
Subject: [OT] a java question
Hi
If we need a variable which can be accessed from any
class, then we set this variable as static and access
it as MyClass.Variable, this variable can be modified
from any class if we dont set this variable as final
like public static final String Variable = "ABC";
here is the problem, i cannot set this variable as
final as the value is set at run time bu the
initalization class, how do i protect it from updated
by any other class.
Ashish
=====
A$HI$H
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
####################################################################### # This message is intended solely for the individual or entity to # # which it is addressed.This communication may contain information # # that is proprietary,privileged or confidential and otherwise legally# # exempt from disclosure. If you are not the named addressee, or have # # been inadvertently referenced in the address line, you are not # # authorized to read, print, retain, copy or disseminate this message # # any part of it. If you have received this message in error , please # # notify the sender immediately by e-mail and delete all copies of # # the message. # #######################################################################
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]