Skip to content

Instantly share code, notes, and snippets.

@nremond
Last active March 31, 2017 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nremond/37c023c1ecf30840a901d6ee7fef70f5 to your computer and use it in GitHub Desktop.
Save nremond/37c023c1ecf30840a901d6ee7fef70f5 to your computer and use it in GitHub Desktop.
class TestSwitch {
public enum Day {
SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY
}
Day day;
public TestSwitch(Day day) {
this.day = day;
}
public void tellItLikeItIs() {
switch (day) {
case MONDAY:
System.out.println("Mondays are bad.");
break;
case FRIDAY:
System.out.println("Fridays are better.");
break;
case SATURDAY: case SUNDAY:
System.out.println("Weekends are best.");
break;
default:
System.out.println("Midweek days are so-so.");
break;
}
}
public static void main(String[] args) {
TestSwitch firstDay = new TestSwitch(Day.MONDAY);
firstDay.tellItLikeItIs();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment