Created
July 24, 2020 12:13
-
-
Save theboreddev/7146651df3138397743925fd5be56016 to your computer and use it in GitHub Desktop.
day_of_week
This file contains hidden or 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
final DayOfTheWeek dayOfTheWeek = DayOfTheWeek.THURSDAY; | |
int position = 0; | |
switch (dayOfTheWeek) { | |
case MONDAY: | |
position = 1; | |
break; | |
case TUESDAY: | |
position = 2; | |
break; | |
case WEDNESDAY: | |
position = 3; | |
break; | |
case THURSDAY: | |
position = 4; | |
break; | |
case FRIDAY: | |
position = 5; | |
break; | |
case SATURDAY: | |
position = 6; | |
break; | |
case SUNDAY: | |
position = 7; | |
break; | |
} | |
System.out.println("Day " + dayOfTheWeek + " is in position " + position + " of the week"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment