i don't not it this is a good practice. . Maybe it's a bad practice but...... but this work and int this way you can mantain the constants public static and final . the other problem is tha if you get the value of the constant before yo initialize you allways obtain a null value....
well sorry for my english.... public class Perro { public static final Constants CONSTANTS; private static String values; private static class Constants{ public static final String uni=loadMethod(); } private static String loadMethod(){ return values; } public static void setLoadMethod(String val){ values =val; new Constants(); } public static void main(String[] args) { setLoadMethod("AAAA"); System.out.println(CONSTANTS.uni); //ALWAYS GET AAAA setLoadMethod("BBBB"); System.out.println(CONSTANTS.uni); } } > 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] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]