Use the keyboard to enter the date and output the calendar of the month

public static void main(String[] args) { Scanner sc = new Scanner(System.in); Println (" Please enter a date, for example: 2021-06-18"); String strDate = sc.next(); //System.out.println(" Date is: "+ strDate); / / output System. The date out. Println (", a \ \ t t two three \ \ t t four five \ \ t t six "); java.sql.Date date = java.sql.Date.valueOf(strDate); Java.sql.Date Calendar = Calendar.getInstance(); //Calendar Calendar = new GregorianCalendar(); Calendar. setTime(date); //System.out.println(calendar); int maxDate = calendar.getActualMaximum(Calendar.DATE); Int day = Calendar. get(Calendar.DATE) int day = Calendar. get(Calendar. // Get the current calendar. Set (calendar. Date, 1); Int num = Calendar.get (Calendar.day_of_week); Int count = num - 1; int count = num - 1; Num -1 for (int I = 1; num-1 for (int I = 1; i < num; I++) {printSystem.out.print ("\t");}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} } for (int i = 1; i <= maxDate; I++) {if (day = = I) {/ / if the current days, with * mark System. Out. Print (I + "* \ t"); } else { System.out.print(i + "\t"); } count++; If (count % 7 == 0) {//count counter, System.out.println(); }}}

The output

Please enter the date, such as: 2021-06-18 2021-07-18 12 3 4 5 6 12 3 5 7 8 9 10 11 12 13 14 15 16 17 18* 19 2021 22 23 24 25 26 27 28 29 30 31