我是靠谱客的博主 无心戒指,这篇文章主要介绍要求输入月份,判断该月所处的季节并输出季节(假设:12、1、2 月为冬季,依次类推),现在分享给大家,希望可以做个参考。

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
public class Task_10101003_03 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("请输入月份:"); int month = input.nextInt(); switch (month) { case 12: case 1: case 2: System.out.println(month+"月是冬季"); break; case 3: case 4: case 5: System.out.println(month+"月是春季"); break; case 6: case 7: case 8: System.out.println(month+"月是夏季"); break; case 9: case 10: case 11: System.out.println(month+"月是秋季"); break; default: System.out.println("你的输入有误,请重新输入"); break; } } }

最后

以上就是无心戒指最近收集整理的关于要求输入月份,判断该月所处的季节并输出季节(假设:12、1、2 月为冬季,依次类推)的全部内容,更多相关要求输入月份,判断该月所处的季节并输出季节(假设:12、1、2内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(62)

评论列表共有 0 条评论

立即
投稿
返回
顶部