What is the output from the following code
enum Level { LOW, MEDIUM, HIGH, URGENT; } enum Color { RED, GREEN, BLUE; } public class Main { public static void main(String[] args) { int diff = Color.RED.compareTo(Level.LOW); // A compile-time error System.out.println(diff); } }
The method compareTo(Color) in the type Enumis not applicable for the arguments (Level)
The code will not compile because it tries to compare the two enum constants, belonging to different enum types: