Compile-time calculation: Difference between revisions

Content deleted Content added
PSNOW123 (talk | contribs)
m Reformatting.
PSNOW123 (talk | contribs)
m Reformatting a long piece of text.
Line 839: Line 839:
=={{header|Java}}==
=={{header|Java}}==
<pre>
<pre>
The Java compiler is able to calculate expressions that contain constant variables and certain operators during code compilation.
The Java compiler is able to calculate expressions that contain constant variables
and certain operators during code compilation.
As defined in the Java language specification, the following operators and expressions may be used for constant expressions:
As defined in the Java language specification,
the following operators and expressions may be used for constant expressions:

Unary operators: +, -, ~, !
Unary operators: +, -, ~, !
Multiplicative operators: *, /, %
Multiplicative operators: *, /, %