十二章 课后作业1
2016-09-11 17:56
169 查看
package dsl.com; public class def { public void s(){ System.out.println("春季"); } public void w(){ System.out.println("夏季"); } public void t(){ System.out.println("秋季"); } public void r(){ System.out.println("冬季"); } }
public class kehou1 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner input=new Scanner(System.in); def o=new def(); System.out.println("请输入月份:"); int i=input.nextInt(); if(i==3||i==4||i==5){ o.s(); }else if(i==6||i==7||i==8){ o.w(); }else if(i==9||i==10||i==11){ o.t(); }else if(i==12||i==1||i==2){ o.r(); } } }