Field Initialization

The initial field value of is determined by the default value for the field type. It is not possible to observe the value of a field before this default initialization has occurred, and a field is thus never "uninitialized".

A field declaration may contain its initialization. For static fields, using initializers is the same as using assignment statements during class initialization, while using them for instance fields is the same as using assignment statements during instance creation.

When a class is initialized, all static fields are initially initialized to default values, and then the field declarations, which contain initializers are initialized. The same process is executed when a class instance is created, but the actions are executed on instance fields.

Static and instance fields are initialized before corresponding static or instance constructors are called. Fields are initialized in the order of field description in the class body.

See also:

Fields