
i hope any one can explain this method ` private void showMonth(int m, int y) {
int lead_spaces = 0;
if (m < 0 || m > 11) {
System.out.println("It should be 1 to 12");
}
else {
System.out.println();
System.out.println(" " + months[m] + " " + y);
System.out.println();
GregorianCalendar cal = new GregorianCalendar(y, m, 0);
System.out.println("Su Mo Tu We Th Fr Sa ");
leadspaces = cal.get(Calendar.DAYOF_WEEK);
int dayofmonth = days[m];
if (cal.isLeapYear(cal.get(Calendar.YEAR)) && m == 1){ dayofmonth++;}
for (int i = 0; i < lead_spaces; i++) {
System.out.print(" ");
}
for (int i = 1; i <= day_of_month; i++) {
if (i < 10) System.out.print(" ");
System.out.print(i);
if ((lead_spaces + i) % 7 == 0) {
System.out.println();
}
else {
System.out.print(" ");
} }
System.out.println(); } }
private static void doSimpleDateFormat() {
Calendar now = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat("E yyyy.MM.dd 'at' hh:mm:ss a zzz");
System.out.print(" \n It is now : " + formatter.format(now.getTime()));
System.out.println();
}
public static void main(String[] args) {
String mo = JOptionPane.showInputDialog("Month");
String ye = JOptionPane.showInputDialog("Year");
int mon = new Integer(mo).intValue();
int yea = new Integer(ye).intValue();
EnglishCalendar k = new EnglishCalendar();
k.showMonth(mon - 1 , yea);
doSimpleDateFormat();
}
plz help me `
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.