A constant expression
is an expression that always produces the same result. More precisely,
a constant expression is an expression that produces a pure value
of a primitive data type and is only composed of the following:

Literals of primitive data types

String literals

Variables that are declared final
and are initialized by constant expressions

Note that expressions that use ++,
- -, and instanceof are not
constant expressions. Also note that expressions that produce or
contain references to objects that are not String objects
are never constant expressions.

The compiler generally evaluates a constant expression and substitutes
the result for the expression during the compilation process.