I have heard about enums before but I have never used them. I thought they were kind of like structs in C but now I see a whole lot of different things that confuse me.
I didn’t have too much trouble with the idea of methods inside an enum but I have a question regarding a certain functionality I read about. Here’s a piece of example code.
public enum Day {
SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
THURSDAY, FRIDAY, SATURDAY
}
Now, this means I can declare a Day variable as any of these values. But I’ve read that you could also somehow declare a value that will “always be true”. It will return true regardless of the comparison. Let’s say we call that value DAY and we declare
x = Day.DAY;
then we should get true from
x == Day.FRIDAY;
How exactly does this work? How do you declare that sort of value in an enum?