JAVA程序设计与实践.rar

源代码在线查看: ex_3_2_3.java

软件大小: 446 K
上传用户: ldh_ncu10
关键词: JAVA 程序设计 实践
下载地址: 免注册下载 普通下载 VIP

相关代码

				/*
				 *文件名 ex_3_2_3.java
				 *说  明:演示if-else-if阶梯
				 */
				class ex_3_2_3
				{
					public static void main(String args[])
					{
						int month = 4; // 四月
						String season;
						if(month == 12 || month == 1 || month == 2)
							season = "冬天";
						else if(month == 3 || month == 4 || month == 5)
							season = "春天";
						else if(month == 6 || month == 7 || month == 8)
							season = "夏天";
						else if(month == 9 || month == 10 || month == 11)
							season = "秋天";
						else
							season = "不存在的月份";
						System.out.println("四月是" + season + ".");
					}
				}			

相关资源