A variable is considered a 'constant variable' only if it is declared:
(a) with the 'final' modifier
(b) with an initializer that's a compile-time constant expression
where a 'compile-time constant expression' is basically an expression that's made up of only literals and other constant expressions or constant variables. (See the
Java Language Spec for a more formal definition.)
Some examples:
[ November 10, 2007: Message edited by: Kelvin Lim ]