>If I set up a class definition with:
>
[quoted text clipped - 32 lines]
>the switch/case shows an error that "case expressions must be constant
>expressions".
Your assignment is legal. But doesn't qualify as a constant expression
See the LRM 15.28 Constant 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:
...
* The unary operators +, -, ~, and ! (but not ++ or --) <<<<
...
Jim
Wojtek Bok - 09 Jun 2005 16:05 GMT
>>------------------------------
>>private static int cvCounter = 0;
[quoted text clipped - 19 lines]
> * The unary operators +, -, ~, and ! (but not ++ or --) <<<<
> ...
Ah ok, now I understand. The constant expression must be constant at
compile time, yet the values are not known until the class is first
instantiated.
Thanks.