Last active
March 31, 2017 11:37
-
-
Save nremond/37c023c1ecf30840a901d6ee7fef70f5 to your computer and use it in GitHub Desktop.
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
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