following code compiles and runs fine.(I'm not consider Exception in
thread main). it works well if static String variable is not final also.
public class Static{
private static final String lookupValue= "main";
static{
try{
//lookupValue = PropertyReader.getValue(Constants.LOOKUP_NAME);
System.out.println(lookupValue);
} catch (Exception e){
//handle exception
}
}
}
Static blocks will be initialized before initializing static variables.---posted by Anand B Raju.
is this above statement true?
thanks.