For switch statements, I understand enum constants are allowed
I understand why they all don't compile. I'm wondering what an enum constant would look like (the last one doesn't compile because it is an enum value, not a constant)
Tami Wakana wrote:I'm wondering what an enum constant would look like (the last one doesn't compile because it is an enum value, not a constant)
Last one doesn't compile because cannot convert from enum DayOfWeek to String i.e. firstName means expecting String found enum
Here java.time.DayOfWeek.SUNDAY is enum constant. They used fully qualified name of enum constant SUNDAY.