Possible Duplicate:
Static initializer in Java
I wondering what this static something (sorry it's my first time encountering this) does for a class or what is its purpose.
public class SomeClass{
//this is a static field
private static String someStaticStringField;
... //other static fields
//what is this?
static{
log.debug("Loading config file");
try{
Class cls = Class.forName("package.ClassName");
properties = new Properties();
...
} catch(Exception e){
log.error("Error in loading config file");
}
}
//this is a static method
public static String getSomeStaticStringField(){
return someStaticStringField;
}
}
On general, what does that static{} do and its purpose for the Class? What is the right term to call it? Is it a Class field, a method, or something else? Thanks