If we want to write a program to output the text based day of the week given a numeric day of the week, we would solve this with nested If Then Else statements.

If Then solution to Weekday

IfWeekday.java

This is tedious and a lot of nesting - There's Got to be a better way... Introducing the Java Switch / Case 

This same problem can be solved with a Switch:

SwitchWeekday.java

Back to Top