类中的Static{……}静态代码块是在编译时就被执行的。 1.在整个程序执行main之前执行的一些操作。 2.static在类加载时就会被执行。 3.在程序编译的时候会自动执行,非运行阶段执行 4.执行顺序与他的位置没有关系,与他所在的类是否被实例化也没有关系。 5.项目运行初始化过程会将static内部的程序加载到内存中,不能有参数值等动态参数。 Last modification:March 4, 2019 © Allow specification reprint Support Appreciate the author AliPayWeChat Like If you think my article is useful to you, please feel free to appreciate