CHAPTER 15: Expressions Previous
Previous
Java Language
Java Language
Index
Index
Next
Next

15.27 Constant Expression


ConstantExpression:

	Expression

A compile-time constant expression is an expression denoting a value of primitive type or a String that is composed using only the following:

Compile-time constant expressions are used in case labels in switch statements (S14.9) and have a special significance for assignment conversion (S5.2).

Examples of constant expressions:

true
(short)(1*2*3*4*5*6)
Integer.MAX_VALUE / 2
2.0 * Math.PI
"The integer " + Long.MAX_VALUE + " is mighty big."



Top© 1996 Sun Microsystems, Inc. All rights reserved.