This is a static initializer block that is used to initialize static members of a class. It is executed when the class is initialized.
Your example:
static { int i1=0; String s1="abc"; double d1=0; };
does not make sense, because it declares variables that are only in scope until the execution of this block is completed.
A more significant static initialization block would be:
static int i1; static String s1; static double d1; static { i1=0; s1="abc"; d1=0; };
This example still does not justify using a static initializer, since you can simply initialize this static variable when they are declared. The static initializer block makes sense when initializing static variables is more complicated.
source share