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 can be thought of as a “class...
  • April 5, 2022
  • 0 Comments
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 defined as private. public static or private static variables are...
  • April 4, 2022
  • 0 Comments
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 how many objects of that type...
  • April 4, 2022
  • 0 Comments