import java.util.Calendar;
import java.util.Scanner;
class Demo {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("请输入年份:");
int year = scan.nextInt();
System.out.print("请输入月份:");
int month = scan.nextInt();
System.out.println("\n\n\t\t"+year + "年" + month + "月\n\n");
System.out.println("周日\t周一\t周二\t周三\t周四\t周五\t周六");
Calendar c = Calendar.getInstance();
c.set(year, month-1, 1);
int weekday = c.get(Calendar.DAY_OF_WEEK);
int maxDay = c.getActualMaximum(Calendar.DAY_OF_MONTH);
int temp = 0;
for (int i = 1; i < weekday; i++){
System.out.print("*\t");
temp++;
}
for (int i = 1; i <= maxDay; i++){
System.out.print(i + "\t");
temp++;
if (temp%7 == 0){
System.out.println();
}
}
}
}