Home > Back-end >  The static keyword
The static keyword

Time:10-19

What is the meaning of this way to write the static?

CodePudding user response:

The static {... }
1: static block of code to run when I was in the class is loaded, and runs only once, and prior to the various blocks of code and the constructor,
2: in general, if need some code at the time of project startup, this time you need a static block of code, such as a project start need to load a lot of configuration files and other resources, we can have in a static block of code,

CodePudding user response:

Static code block, generally used to initialize static variables, this should be used to at the beginning of the class starts the first output and success,
  • Related