Παράδειγμα: εύρεση ημέρας


import java.util.Calendar;
import java.util.GregorianCalendar;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;

class FindDay {
  /** Return the name of the given numeric week day */
  public static String weekDayName(int weekNumber) {
    return switch (weekNumber) {
      case Calendar.MONDAY -> "Δευτέρα";
      case Calendar.TUESDAY -> "Τρίτη";
      case Calendar.WEDNESDAY -> "Τετάρτη";
      case Calendar.THURSDAY -> "Πέμπτη";
      case Calendar.FRIDAY -> "Παρασκευή";
      case Calendar.SATURDAY -> "Σάββατο";
      case Calendar.SUNDAY -> "Κυριακή";
      default -> throw new IllegalStateException("Unexpected value: " + weekNumber);
    };
  }

  public static void main(String args[]) throws Exception {
  // ...
}