if (c.equals("BLUE"))
System.out.print("blue ");
How can this be possible??? as far as i think "BLUE" will be a String object in the String pool whereas the c is an enum reference variable which will have RED,GREEN,BLUE and YELLOW enum constants. The two cannot be meaningful equivalents at all because enum constants are not a string.
then you can compare
c.getName().equals("BLUE");
Well one more method is convert your enum constant to a String and then compare. The original code that you had given. change c.equals("Blue"); to c.toString().equals("BLUE");