I have an enum, for example enum Color { Red, Brown }
. I also have some variables of that type:
Color c1 = Brown, c2 = Red
What is best way to compare to a constant value:
if (c1 == Color.Brown) {
//is brown
}
or
if (c1.equals(Color.Brown)) {
//is brown
}