This question already has an answer here:
I was looking over some code the other day and I came across:
static {
...
}
Coming from C++, I had no idea why that was there. Its not an error because the code compiled fine. What is this "static" block of code?
A static block executes once in the life cycle of any program, another property of static block is that it executes before the main method.