题解 | #获得月份天数#
获得月份天数
https://www.nowcoder.com/practice/13aeae34f8ed4697960f7cfc80f9f7f6
import java.util.Scanner;
import java.time.LocalDate;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNextInt()) {
String[] str=in.nextLine().split(" ");
int year=Integer.parseInt(str[0]);
int month=Integer.parseInt(str[1]);
LocalDate date=LocalDate.of(year,month,1);
System.out.println(date.lengthOfMonth());
}
}
}
