1 | Suppose you are given an unknown color c |
2 | To check if c is red, use: if ( c.equals( Color.red ) ) ... |
3 | Do not use if ( c == Color.red ) ... since this comparison will always be false! |
4 | The reason is subtle: c and Color.red are distinct objects (although their values are equal) |