Compile-time calculation: Difference between revisions
Content deleted Content added
m Reformatting. |
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 |
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, |
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: *, /, % |