Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.text.DateFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class Main {

    public static void main(String[] args) {
        DateFormatSymbols symbols = new DateFormatSymbols(new Locale("en", "US"));
        String[] defaultDays = symbols.getShortWeekdays();

        for (int i = 0; i < defaultDays.length; i++) {
            System.out.print(defaultDays[i] + "  ");
        }
        System.out.println();

        String[] capitalDays = { "", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
        symbols.setShortWeekdays(capitalDays);

        String[] modifiedDays = symbols.getShortWeekdays();
        for (int i = 0; i < modifiedDays.length; i++) {
            System.out.println(modifiedDays[i] + "  ");
        }

        SimpleDateFormat formatter = new SimpleDateFormat("E", symbols);
        Date today = new Date();
        String result = formatter.format(today);
        System.out.println(result);

    }
}