Compile-time calculation: Difference between revisions

m
Reformatting.
m (Added more explanation about Java's compile time limitations.)
m (Reformatting.)
Line 838:
 
=={{header|Java}}==
<pre>
The Java compiler is able to calculate expressions that contain constant variables
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:
the following operators and expressions may be used for constant expressions:
Unary operators: +, -, ~, !
Multiplicative operators: *, /, %
Line 854 ⟶ 853:
Parenthesized expressions whose contained expression is a constant expression
Simple names that refer to constant variables
</pre>
<syntaxhighlight lang="java">
 
894

edits