标签:end color str ati log 方法 rgs print maximum
package ppt11util类; import java.util.Calendar; public class TprintCalendar { public static void main(String[] args) { printCalendar(2017,6); } public static void printCalendar(int year,int month){ System.out.println("日\t一\t二\t三\t四\t五\t六"); Calendar cal = Calendar.getInstance(); cal.set(Calendar.MONTH,(month-1)); cal.set(Calendar.YEAR,year); //1号是周几 int what = cal.get(Calendar.DAY_OF_WEEK); for (int i = 0; i < what; i++) { System.out.print("\t"); } for (int i = 1; i <= cal.getActualMaximum(Calendar.DAY_OF_MONTH); i++) { System.out.print(i+"\t"); if((what+i)%7==0){ System.out.println(""); } } } }
标签:end color str ati log 方法 rgs print maximum
原文地址:http://www.cnblogs.com/0717GG/p/7090810.html