fork(7) download
  1. import java.util.*;
  2. import java.text.*;
  3.  
  4. class MonthDemo {
  5. public static String getMonthName_Abbr(int month) {
  6. Calendar cal = Calendar.getInstance();
  7. cal.set(Calendar.MONTH, month);
  8. SimpleDateFormat month_date = new SimpleDateFormat("MMM");
  9. String month_name = month_date.format(cal.getTime());
  10. return month_name;
  11. }
  12.  
  13. public static void main(String[] args) {
  14. for (int i = 0; i <= 11; i++) {
  15. System.out.println(getMonthName_Abbr(i));
  16. }
  17. }
  18. }
Success #stdin #stdout 0.05s 246080KB
stdin
Standard input is empty
stdout
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec