JapaneseCalendar.java Source code

Java tutorial

Introduction

Here is the source code for JapaneseCalendar.java

Source

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

public class JapaneseCalendar {
    public static void main(String args[]) {
        Locale locale = new Locale("ja", "JP", "JP");
        Calendar now = Calendar.getInstance(locale);

        Map<String, Integer> names = now.getDisplayNames(Calendar.ERA, Calendar.LONG, locale);
        System.out.printf("%s%n", names);
        System.out.printf("It is year %tY of the current era%n", now);
        System.out.printf("The calendar class is: %s%n", now.getClass().getName());
    }
}