Comparing enum elements in Java: use == or equals()?
Hello everyone! I'm a beginner Java developer, and I have a question about working with enums. \n\nLet's say I have this enum:\n\n```java\npublic enum Color {\n RED, GREEN, BLUE;\n}\n```\n\nAnd I want to compare two variables of this type, for example:\n\n```java\nColor c1 = Color.RED;\nColor c2 = Color.RED;\n```\n\nI see two ways of comparison in other developers' code:\n\n```java\nif (c1 == c2) { ... }\n```\n\nand\n\n```java\nif (c1.equals(c2)) { ... }\n```\n\nBoth options seem to work, but I don't understand which one is correct and why. Online sources say that == works reliably for enums, but usually for objects we use equals(). \n\nPlease explain:\n1. Which method is preferable and why?\n2. Can == give a false result in any cases?\n3. Is there any