DisplayNames.java Source code

Java tutorial

Introduction

Here is the source code for DisplayNames.java

Source

import java.util.Calendar;
import java.util.Locale;
import java.util.Map;

public class DisplayNames {
    public static void main(String args[]) {
        Calendar now = Calendar.getInstance();
        // Locale locale = Locale.getDefault();
        Locale locale = Locale.ITALIAN;
        Map<String, Integer> names = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale);
        System.out.println(names);
        String name = now.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, locale);
        System.out.printf("Today is a %s.%n", name);
    }
}