Import Java.util.Calendar;
public class Calendar0 {
public static void Main (String[]args) {
Calendar cal = Calendar.getinstance ();
int Year=cal.get (calendar.year);//Current year
int month=cal.get (calendar.month);//Current Month
int day=cal.get (Cale Ndar. Day_of_month);//Today is the day
int week=cal.get (Calendar.day_of_week) -1;//today, Monday is 1, Sunday is 0
int week0= (week-day%7+1)% 7;//this month is a number of days of the week
Int[] month={31,28,31,30,31,30,31,31,30,31,30,31};//the number of months in a year
int count=0;
SYSTEM.OUT.PRINTLN (year+ "year" + (month+1) + "month" +day+ "Day");
System.out.println ("sun\t" + "mon\t" + "tue\t" + "wed\t" + "thu\t" + "fri\t" + "sat\t");
while (week0!=0) {
System.out.print ("\ t");
week0--;count++;
}
if ((year%400==0) | | | (year%4==0&&year%100!=0))
Month[1]=29;
for (int i=0;i<month[month];i++) {
System.out.print ((i+1) + "\ t");
count++;
if (count%7==0)
System.out.println ();
}
}
}
Java program-Output month calendar table