Why is the final byte not compiled in the case of a switch statement?
1 answer
Since c is a final variable, it is not a compile time constant
Not. The rules for constant expressions are given in JLS 15.28 , and they do not include wrapper types:
A constant expression is an expression denoting a primitive type or String value that does not terminate abruptly and is composed using only the following [...]
The wrapper type is not a primitive type and String
.
+5
source to share