Skip to content

Instantly share code, notes, and snippets.

@theboreddev
Created July 24, 2020 12:13
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 theboreddev/7146651df3138397743925fd5be56016 to your computer and use it in GitHub Desktop.
Save theboreddev/7146651df3138397743925fd5be56016 to your computer and use it in GitHub Desktop.
day_of_week
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