题解 | #输出某一年的各个月份的天数#

输出某一年的各个月份的天数

http://www.nowcoder.com/practice/6cc6d87805cc4e32866be0541998d8c9

import java.util.Calendar; import java.util.Scanner;

public class Main { public static void main(String[] args) { Scanner console = new Scanner(System.in); int year = console.nextInt();

    //write your code here......
            Calendar cl = Calendar.getInstance();
    for (int i = 1 ; i <= 12 ; i++){
        cl.set(year, i, 0);
        System.out.println(year + "年" + i + "月:" + cl.get(Calendar.DATE) + "天");
    }

}

}

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-08 13:05
点赞 评论 收藏
分享
CARLJOSEPH...:宝宝你戾气太大了
点赞 评论 收藏
分享
05-22 17:07
已编辑
门头沟学院 Java
程序员牛肉:都啥时候了还jb打蓝桥杯呢,有限找实习。
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务