Well, i put the main for the example... but you need the class Perro before you get the constant value
i Hope some like this. Perro.setLoadMethod(theInitval); then su can obtain Perro.CONSTANT.uni...... .... Cordial Saludo John J López > Hi > how will this class work if there is no public static > void main method and have to be initialized by some > other class > Ashish > --- [EMAIL PROTECTED] wrote: > >> 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] >> >> > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Mail - Easier than ever with enhanced search. Learn more. > http://info.mail.yahoo.com/mail_250 > > --------------------------------------------------------------------- > 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]