If a variable declared inside a static initializer block can not be accessed in main() as shown in code, then whats the use of such a variable ? Where can I use this variable ? Whats the point in using static initializer block ?
posted 4 years ago
Static Initialization Blocks as the name says Initialize the variables. They are run just once even before the constructor of the class is run. So you can use these blocks to initialize variables.