Java Calendar getDisplayNames方法


Java Calendar getDisplayNames方法

package com.codingdict;

import java.util.*;

public class CalendarDemo {
   public static void main(String[] args) {

      // create calendar and locale
      Calendar now = Calendar.getInstance();
      Locale locale = Locale.getDefault();

      // call the getdisplaynames method
      Map< String, Integer> representations =
      now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale);
      NavigableMap< String, Integer> navMap =  
      new TreeMap< String, Integer>(representations);

      // print the results
      System.out.printf("Whole list:%n%s%n", navMap);
   }
}