- /**
- *
- * @author 张耀军
- */
- import java.util.Scanner;
- class abc
- {
- public static void main(String[] args)
- {
- int i=1;
- i*=2;
- String season[]={"春","夏","秋","冬"};
-
-
- String str="";
- try{
- Scanner sc=new Scanner(System.in);
- System.out.println("请输入月份:");
- int month=sc.nextInt();
-
- if(month==1||month==2||month==12)
- str=season[3];
- else if(month==3||month==4||month==5)
- str=season[0];
- else if(month==6||month==7||month==8)
- str=season[1];
- else if(month==9||month==10||month==11)
- str=season[2];
- else
- str="输入有误";
- System.out.println(str);
- }catch(Exception e){
- e.printStackTrace();
- }
-
- }
- }
复制代码 |
|