IntelliJ IDEA 2021.2 Help

Add new field or constant

ItemDescription
VisibilitySelect the desired visibility modifier.
TypeSpecify the type of the new field. Note that code completion works here. As you type, the suggestion list shrinks to show the matching options. Non-existent type is marked as a syntax error.
NameSpecify the name of the new field.
Initializer

Specify the initial value of the new field. Note that such value should correspond to the declared type. For example, if the type is String, the suggested initializer should be enclosed in quotes.

Note that code completion works here. As you type, the suggestion list shrinks to show the matching options. Non-existent type is marked as a syntax error.

StaticAdd static to the field declaration.
FinalAdd final to the field declaration.
PreviewThis read-only area shows the draft declaration as you fill in the dialog fields.
Last modified: 02 September 2021