1、public class Month{

public static void main(String args[]){

for (int i = 1;i <= 12 ;i++ )

{

if (i == 3 || i == 4 || i == 5)

{

System.out.println(i+"月份是春季");

}

if (i == 6 || i == 7 || i == 8)

{

System.out.println(i+"月份是夏季");

}

if (i == 9 || i == 10 || i == 11)

{

System.out.println(i+"月份是秋季");

}

if (i == 12 || i == 1 || i == 2)

{

System.out.println(i+"月份是冬季");

}

}

}

}

2、public class Month{

public static void main(String args[]){

for (int i = 1;i <= 12;i++ )

{

switch(i)

{

case 1:System.out.println("1月份是冬季");break;

case 2:System.out.println("2月份是冬季");break;

case 3:System.out.println("3月份是春季");break;

case 4:System.out.println("4月份是春季");break;

case 5:System.out.println("5月份是春季");break;

case 6:System.out.println("6月份是夏季");break;

case 7:System.out.println("7月份是夏季");break;

case 8:System.out.println("8月份是夏季");break;

case 9:System.out.println("9月份是秋季");break;

case 10:System.out.println("10月份是秋季");break;

case 11:System.out.println("11月份是秋季");break;

case 12:System.out.println("12月份是冬季");break;

default:;

}

}

}

}

//default的后面还是要加:  之后在加;

最新文章

  1. 纯PHP实现定时器任务(Timer)
  2. Oracle数据库——数据库安全性管理
  3. Authentication token manipulation error for ubuntu ubuntu-16.04.1-desktop-amd64
  4. maven3实战之设置HTTP代理
  5. 查看当前hadoop的版本号
  6. Android窗口管理服务WindowManagerService计算窗口Z轴位置的过程分析
  7. J2SE学习小结
  8. java解析上传的excel
  9. leetcode range sum query
  10. 【python】spark+kafka使用
  11. Entity Frame Code First 简易教程
  12. Jenkins报错&#39;Gradle build daemon disappeared unexpectedly&#39;的问题解决
  13. eclipse项目运行文件位置
  14. 20155326刘美岑 2016-2017-2 《Java程序设计》第二周学习总结
  15. [ 9.9 ]CF每日一题系列—— 259A黑白棋盘检查问题
  16. 利用Regsvr32绕过Applocker的限制策略
  17. 【ORACLE 】查询被锁住的对象,并结束其会话
  18. Hibernate5笔记3--详解Hibernate的API
  19. 学习c++ofstream和ifstream
  20. php redis安装使用

热门文章

  1. 组件中的data为什么不是一个对象而是一个函数?
  2. Quartz 2D CGPattern学习笔记
  3. 读《高情商修炼手册》有感 output
  4. python多线程的问题
  5. ACCESS中查询语句:查询所得数据另存到一个指定目录下的文件夹里,并新建新的文件
  6. SQL 查找是否”存在”,别再用 COUNT 了,真的很费时间!
  7. prometheus-alertmanager 告警规则
  8. Oracle数据库字符集与国家字符集
  9. Android Custom View使用Databinding
  10. C++ Error:C2011: &#39;struct&#39; type redefinition