Static block is used to initialize static variables. Static block is always executed before main block.
Let us take an example of static block and see if it executes before main block.
Static Block : Example
Static Block : Output
We can see in the output that the static block is executed before main block and the static variable a is assigned value before main() starts executing.