Recently in a lot of programs I’ve been looking at, I’ve noticed
static {
//some code here
}
I’m just looking for some information about this particularly, I’m used to blocks of code all being in methods, or simply classes, does this simply set all code within the block with a static modifier, or is there something more to it?
This might be a duplicate question from
Static Initialization Blocks
The static block only gets called once, no matter how many objects of that type you create.