Originally posted by Raji Addepalli:
public class test3{
public static void main(String args[])
{
int x,y=10;
switch(y) {
case 10: x=5;
break;
case5 : break;
default: x=0;
}
System.out.println(y);
}
}
My best guess would be that you need a space after the keyword case and before the number 5. Without the space, the compiler won't recognize that as the keyword case, but as a new identifier for a label. Is this compiling? I'm surprised that you're not getting an "unreachable code" error.
Corey