Created
September 3, 2020 14:20
-
-
Save SiAust/3926920e294f1533a168e1aaed41c944 to your computer and use it in GitHub Desktop.
Example of an enum class.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum DayOfWeek { | |
MONDAY(1,true), | |
TUESDAY(2,true), | |
WEDNESDAY(3,false), | |
THURSDAY(4,false), | |
FRIDAY(5,true), | |
SATURDAY(6,false), | |
SUNDAY(7,true); | |
private final boolean sunny; | |
private final int dayOfWeek; | |
DayOfWeek(int dayOfWeek, boolean sunny) { | |
this.sunny = sunny; | |
this.dayOfWeek = dayOfWeek; | |
} | |
public boolean isSunny() { | |
return sunny; | |
} | |
public int getDayOfWeek() { | |
return dayOfWeek; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment