I've got a problem with compile time constant expression.
There are several places in which we need them, for example they are used in case labels in switch statements....
first consider this example:
According to JLS rules ,(n==2) is not
considered to be a compile time constant expression, although "n" is known @ compile time. hence a compile time error occurs.
To fix the problem, we can do this,for example:
the if() statement is now a compile time constant expression.
But WHY the example below doesn't work?
[ Jess added
UBB [code] tags to preserve whitespace, check 'em out! ]
[ January 31, 2003: Message edited by: Jessica Sant ]