First on the code:
Importconnection. Firstpanel;ImportJava.util.Calendar;Importjava.util.Date;ImportJava.util.Scanner;//Why use the date class? Because the Calendar class internationalization standard Public classMain { Public Static voidMain (string[] args) {Scanner sc=NewScanner (system.in); String[] 中文版= {"One", "two", "three", "four", "five", "six", "Day"}; String[] Month= {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December",}; while(Sc.hasnext ()) {intCC = 0; intYear =Sc.nextint (); Calendar Calendar=calendar.getinstance (); for(inti = 0; I <12;i++) {System.out.println (month[cc++]); for(intj = 0; J <english.length;j++) {System.out.printf ("%3s", English[j]); } System.out.println (); Calendar.clear (); Calendar.set (calendar.year,year); Calendar.set (Calendar.month,i); intMonth_days =Calendar.getactualmaximum (Calendar.day_of_month); intFirst_day = Calendar.get (calendar.day_of_week)-1; intN =0; if(first_day>0){ for(intK = 2; K<=first_day; k++) {n= First_day-1; System.out.printf ("%4s", "" "); } } if(first_day==0) {n= 6; for(intK = 1; k< 7; k++) {System.out.printf ("%4s", "" "); } } for(intk = 1; k<=month_days;k++) {System.out.printf ("%3d", K); N++; if(n%7==0) {System.out.println (); }} System.out.println (); } } } }
Some example methods are given using Java.util.Calendar in Java and (Internationalized standard date Class).
Java Console Simple Calendar view