Actualy it happend because
when we write this enum class like this
enum Color {red, green, blue}
then
java complier includes internally like this
public class TestEnum {
static final class Color exteds Enum
{
public static final Color = red;
public static final Color = green;
public static final Color = blue;
static
{
red = new Color("red",0);
green = new Color("green",1);
blue = new Color("blue",2);
}
public static void main(String[] args) {
Color c = Color.red;
switch(c){
case red: System.out.println("red ");
}
}
}