Static Block in Java
It’s a static initializer. It’s executed when the class is loaded (or initialized, to be precise, but you usually don’t notice the difference). It … Read more
It’s a static initializer. It’s executed when the class is loaded (or initialized, to be precise, but you usually don’t notice the difference). It … Read more
Of course it can be accessed as ClassName.var_name, but only from inside the class in which it is defined – that’s because it is … Read more
The non-static block: Gets called every time an instance of the class is constructed. The static block only gets called once, when the class itself is initialized, no matter … Read more