I am implementing a simple switch case which will switch on an Enum value. Following is the code
ScheduleType scheduleType = ScheduleType.valueOf(scheduleTypeString);
switch (scheduleType) {
case ScheduleType.CRON_EXPRESSION:
System.out.println("Cron");
break;
}
But I am getting the following error in my IDE:
The qualified case label ScheduleType.CRON_EXPRESSION must be replaced with the unqualified enum constant CRON_EXPRESSION
Can somebody explain why do I get this error and what's wrong with the code. I know the right way to do is to remove the ClassName, but why do I need to do that? Because generally in comparisons I do use it like for example in equals and all. Thanks