What does static succeeded only by two curly brackets means? Sorry for the beginner question. I tried to look for a tutorial on it, but couldn't find one. This use of static as: static {}, is not clear for me. I found it being used by others heredeveloperWorks. I thought it may be a multiline, or group, modifier and tried the code below, but other type modifiers give errors not like static.
public class MyClass {
private volatile int v1=0;
private final int v2=0;
private static int v3=0;
static { <----- No error here.
int i1=0;
String s1="abc";
double d1=0;
};
final { <----- Error here.
int i2=0;
String s2="abc";
double d2=0;
};
volatile { <----- Error here.
int i3=0;
String s3="abc";
double d3=0;
};
}