← Unit 2 · all exercises
Saved in this browser only

Name the day

Return the name of the day for a number from 1 to 7, where 1 is "Monday" and 7 is "Sunday". For anything outside that range return "unknown".

String dayName(int day)

Solution.java
Loading editor…
Results

Examples

  • dayName(1) → Monday
  • dayName(7) → Sunday

There are also 4 hidden tests you can't see. Solve the problem, not the examples.