public class 计算出任意一年的二月份多少天 {
public static void main(String[] args)throws Exception{
// 计算出任意一年的二月份多少天
Scanner sc = new Scanner(System.in);
System.out.println("请输入年份");
int year = sc.nextInt();
Calendar c= Calendar.getInstance();
c.set(year, 2,1);
c.add(Calendar.DATE,-1);
System.out.println(c.get(Calendar.DATE));
}
} |
|