static blocks and static initializers in Java
In Java, static blocks are blocks of code within a class that are executed when the class is first loaded into memory by the JVM. They are primarily used for initializing static variables or for executing setup code that should run once.
Example