Don Clugston:
Do you have a reference for this Java behaviour? I did a quick google, and everything I found indicates that case labels must be constants.
Thank you for your answer, Don.
I have compiled this Java code:
class Main {
public static void main(String[] args) {
int x = 2;
int y = 2;
switch(x) {
case 1: break;
case y: break;
}
}
}
It gives:
Main.java:7: error: constant expression required
case y: break;
^
1 error
As you see:
http://ideone.com/wAXMZ
Bye,
bearophile
