- The block that you show in your message is not an empty block, it is a static initializer. It is used to provide non-trivial initialization for the static variables of your class.
- The local variables that you use during initialization go on the stack, with the exception of objects that you allocate from the heap
x, . x .
x , :
private static int x;
static {
x = 5;
}
:
private static int x = 5;
, , :
private static List<List<String>> x = new ArrayList<List<String>>();
static {
for (int i = 0 ; i != 10 ; i++) {
x.add(new ArrayList<String>(20));
}
}