Skip to content

java static 块

Posted on:August 23, 2022 at 01:35 PM



static 块

static block

8.7 Static Initializers
A static initializer declared in a class is executed when the class is initialized
(§12.4.2). Together with any field initializers for class variables (§8.3.2), static
initializers may be used to initialize the class variables of the class.

static 块会在类加载之后回调,在对象实例化之前