class A{
static{
//initialize all things here
}
}
This is the way I use static blocks in my code. But as we can also keep multiple static blocks in a class
class A{
static{
//do something here
}
static{
//do something else here
}
}
I have seen cases where multiple static blocks have been used, but can't seem to figure out why?
I suppose if it is for readability below method can also be used
class A{
static{
someMethod();
someOtherMethod();
}
}
Are there any other advantages of multiple static blocks other than readability?